-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNinjapool.java
More file actions
46 lines (35 loc) · 1.2 KB
/
Copy pathNinjapool.java
File metadata and controls
46 lines (35 loc) · 1.2 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
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 Ninjapool extends GenericPool<GameCharacter> {
private TiledTextureRegion mTextureRegion;
private VertexBufferObjectManager VBO;
public Animator animator;
public Ninjapool(TiledTextureRegion ninjaTexture, VertexBufferObjectManager vbo, Animator anima) {
if (ninjaTexture == 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 = ninjaTexture;
VBO = vbo;
animator = anima;
}
@Override
protected GameCharacter onAllocatePoolItem() {
// TODO Auto-generated method stub
return new GameCharacter(0, 0, mTextureRegion, VBO, animator);
}
/**
* Called when a Bullet is sent to the pool
*/
@Override
protected void onHandleRecycleItem(final GameCharacter ninja) {
//ninja.setIgnoreUpdate(true);
ninja.collect();
}
@Override
protected void onHandleObtainItem(final GameCharacter ninja) {
ninja.resetCharacter();
}
}