|
9 | 9 | import com.badlogic.gdx.graphics.Color; |
10 | 10 | import com.badlogic.gdx.math.MathUtils; |
11 | 11 | import com.badlogic.gdx.math.Vector2; |
12 | | -import com.badlogic.gdx.physics.box2d.Body; |
13 | | -import com.badlogic.gdx.physics.box2d.Filter; |
14 | | -import com.badlogic.gdx.physics.box2d.Fixture; |
15 | | -import com.badlogic.gdx.physics.box2d.RayCastCallback; |
16 | | -import com.badlogic.gdx.physics.box2d.World; |
| 12 | +import com.badlogic.gdx.physics.box2d.*; |
17 | 13 | import com.ychstudio.builders.ActorBuilder; |
18 | | -import com.ychstudio.components.Bomb; |
19 | | -import com.ychstudio.components.Player; |
20 | | -import com.ychstudio.components.Renderer; |
21 | | -import com.ychstudio.components.RigidBody; |
22 | | -import com.ychstudio.components.State; |
| 14 | +import com.ychstudio.components.*; |
23 | 15 | import com.ychstudio.components.Transform; |
24 | 16 | import com.ychstudio.gamesys.GameManager; |
| 17 | + |
25 | 18 | import java.util.Queue; |
26 | 19 |
|
27 | 20 | public class PlayerSystem extends IteratingSystem { |
28 | 21 |
|
29 | 22 | protected ComponentMapper<Player> mPlayer; |
30 | | - protected ComponentMapper<Transform> mTransform; |
31 | 23 | protected ComponentMapper<RigidBody> mRigidBody; |
32 | 24 | protected ComponentMapper<State> mState; |
33 | 25 | protected ComponentMapper<Renderer> mRenderer; |
@@ -58,7 +50,7 @@ protected void process(int entityId) { |
58 | 50 | float maxSpeed = player.maxSpeed; |
59 | 51 |
|
60 | 52 | if (player.hp > 0 && player.state != Player.State.TELEPORTING) { |
61 | | - // TODO: cheat code... |
| 53 | + // cheat code... |
62 | 54 | if (Gdx.input.isKeyJustPressed(Input.Keys.NUM_1)) { |
63 | 55 | player.powerUpAmmo(); |
64 | 56 | } |
@@ -172,7 +164,7 @@ protected void process(int entityId) { |
172 | 164 | if (Gdx.input.isKeyJustPressed(Input.Keys.Z) && player.remoteBomb) { |
173 | 165 | Queue<Entity> remoteBombQueue = GameManager.getInstance().getRemoteBombDeque(); |
174 | 166 |
|
175 | | - // clean those bomes which have already exploded |
| 167 | + // clean those bombs which have already exploded |
176 | 168 | while (!remoteBombQueue.isEmpty() && remoteBombQueue.peek().getComponent(Bomb.class) == null) { |
177 | 169 | remoteBombQueue.remove(); |
178 | 170 | } |
@@ -258,11 +250,12 @@ protected void process(int entityId) { |
258 | 250 | if (state.getStateTime() > 0.65f) { |
259 | 251 | World b2dWorld = body.getWorld(); |
260 | 252 | b2dWorld.destroyBody(body); |
261 | | - mPlayer.set(entityId, false); |
262 | | - mRigidBody.set(entityId, false); |
263 | | - mState.set(entityId, false); |
264 | | - Transform transform = mTransform.get(entityId); |
265 | | - transform.z = 999; |
| 253 | + world.delete(entityId); |
| 254 | +// mPlayer.set(entityId, false); |
| 255 | +// mRigidBody.set(entityId, false); |
| 256 | +// mState.set(entityId, false); |
| 257 | +// Transform transform = mTransform.get(entityId); |
| 258 | +// transform.z = 999; |
266 | 259 |
|
267 | 260 | GameManager.playerLives--; |
268 | 261 | if (!GameManager.infiniteLives && GameManager.playerLives <= 0) { |
|
0 commit comments