-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAngelpool.java
More file actions
49 lines (40 loc) · 1.3 KB
/
Copy pathAngelpool.java
File metadata and controls
49 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.smiths;
import org.andengine.opengl.texture.region.TiledTextureRegion;
import org.andengine.opengl.vbo.VertexBufferObjectManager;
import org.andengine.util.adt.pool.GenericPool;
public class Angelpool extends GenericPool<Angel>{
public TiledTextureRegion mTextureRegion;
public VertexBufferObjectManager VBO;
public Angelpool(TiledTextureRegion angelTexture, VertexBufferObjectManager vbo) {
if (angelTexture == null) {
// Need to be able to create a Sprite so the Pool needs to have a TextureRegion
throw new IllegalArgumentException("The texture region must not be NULL");
}
mTextureRegion = angelTexture;
VBO = vbo;
}
/**
* Called when a Bullet is required but there isn't one in the pool
*/
@Override
protected Angel onAllocatePoolItem() {
// TODO Auto-generated method stub
return new Angel(0, 0, mTextureRegion, VBO);
}
/**
* Called when a Bullet is sent to the pool
*/
@Override
protected void onHandleRecycleItem(final Angel pangel) {
//pangel.setIgnoreUpdate(true);
pangel.collect();
}
/**
* Called just before a Bullet is returned to the caller, this is where you write your initialize code
* i.e. set location, rotation, etc.
*/
@Override
protected void onHandleObtainItem(final Angel pangel) {
pangel.reset();
}
}