-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLvl3BossLaserPool.java
65 lines (54 loc) · 2.29 KB
/
Lvl3BossLaserPool.java
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package mkat.apps.spacewars;
import org.andengine.engine.handler.physics.PhysicsHandler;
import org.andengine.util.adt.pool.GenericPool;
public class Lvl3BossLaserPool extends GenericPool<Lvl3BossLaser> {
/* The pool constructor assigns the necessary objects needed to
* construct sprites */
//private static final float DEMO_VELOCITY = 200.0f;
public Lvl3BossLaserPool(int i){
super(i);
}
/* onAllocatePoolItem handles the allocation of new sprites in the
event that we're attempting to obtain a new item while all pool
items are currently in use */
protected Lvl3BossLaser onAllocatePoolItem(float x, float y, float angle, Lvl3Boss callingBoss) {
//super.onAllocatePoolItem();
//Log.v("","runs to allocate a enemy laser");
Lvl3BossLaser bl = new Lvl3BossLaser(GameLevel.getInstance().pBossLaserTexture, x, y, angle, callingBoss);
//final PhysicsHandler physicsHandler = new PhysicsHandler(bl);
//bl.registerUpdateHandler(physicsHandler);
//physicsHandler.setVelocity(DEMO_VELOCITY, DEMO_VELOCITY);
//GameLevel.getInstance().attachChild(bl);
return bl;
}
//GameLevel.getInstance().attachChild(pl);
//Log.v("something", "enemy created with modifiers and listeners");
@Override
protected void onHandleRecycleItem(Lvl3BossLaser pItem){
super.onHandleRecycleItem(pItem);
pItem.clearEntityModifiers();
pItem.clearUpdateHandlers();
pItem.setVisible(false);
pItem.reset();
//GameLevel.getInstance().recycleBullet = true;
//Log.v("","recycled a enemy laser icon3");
}
public synchronized Lvl3BossLaser obtainPoolItem(float x, float y, float angle, Lvl3Boss callingBoss) {
// TODO Auto-generated method stub
super.obtainPoolItem();
//Log.v("","runs to obtain a enemy laser");
Lvl3BossLaser bl = new Lvl3BossLaser(GameLevel.getInstance().pBossLaserTexture, x, y, angle, callingBoss);
//final Ball ball = new Ball(centerX, centerY, this.mFaceTextureRegion);
//final PhysicsHandler physicsHandler = new PhysicsHandler(bl);
//bl.registerUpdateHandler(physicsHandler);
//physicsHandler.setVelocity(DEMO_VELOCITY, DEMO_VELOCITY);
GameLevel.getInstance().attachChild(bl);
return bl;
}
@Override
protected Lvl3BossLaser onAllocatePoolItem() {
// TODO Auto-generated method stub
//Log.v("", "Shouldn't run~");
return null;
}
}