|
1 | 1 | package bomberman.entity.player;
|
2 | 2 |
|
3 | 3 | import bomberman.Renderer;
|
4 |
| -import bomberman.animations.Direction; |
| 4 | +import bomberman.constants.Direction; |
5 | 5 | import bomberman.animations.PlayerAnimations;
|
6 | 6 | import bomberman.animations.Sprite;
|
7 | 7 | import bomberman.constants.GlobalConstants;
|
@@ -43,7 +43,7 @@ private void init() {
|
43 | 43 | name = "Player";
|
44 | 44 | playerBoundary = new RectBoundedBox(positionX, positionY, GlobalConstants.PLAYER_WIDTH, GlobalConstants.PLAYER_HEIGHT);
|
45 | 45 |
|
46 |
| - playerAnimations = new PlayerAnimations(); |
| 46 | + playerAnimations = new PlayerAnimations(this); |
47 | 47 |
|
48 | 48 | positionX = GlobalConstants.PLAYER_X;
|
49 | 49 | positionY = GlobalConstants.PLAYER_Y;
|
@@ -83,8 +83,7 @@ public boolean isColliding(Entity b) {
|
83 | 83 |
|
84 | 84 | @Override
|
85 | 85 | public void draw() {
|
86 |
| - currentSprite.setPosition(positionX, positionY); |
87 |
| - if (currentSprite != null) { |
| 86 | + if (currentSprite != null) { |
88 | 87 | Renderer.playAnimation(currentSprite);
|
89 | 88 | }
|
90 | 89 | }
|
@@ -133,4 +132,14 @@ public void reduceHealth(int damage) {
|
133 | 132 | public void removeFromScene() {
|
134 | 133 | throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
135 | 134 | }
|
| 135 | + |
| 136 | + @Override |
| 137 | + public int getPositionX() { |
| 138 | + return this.positionX; |
| 139 | + } |
| 140 | + |
| 141 | + @Override |
| 142 | + public int getPositionY() { |
| 143 | + return this.positionY; |
| 144 | + } |
136 | 145 | }
|
0 commit comments