Rudimentary colisioncheck
This commit is contained in:
@ -22,6 +22,7 @@ public class PacMan {
|
||||
private static final int COLLISION_BOX_SIZE = 16;
|
||||
private static final int COLLISION_BOX_OFFSET = (PACMAN_SIZE - COLLISION_BOX_SIZE) / 2;
|
||||
private final Game game;
|
||||
private final Point startPosition;
|
||||
private int aniTick = 0;
|
||||
private int aniIndex = 0;
|
||||
private static final int ANIMATION_UPDATE_FREQUENCY = 10;
|
||||
@ -39,9 +40,10 @@ public class PacMan {
|
||||
public PacMan(Game game, CollisionChecker collisionChecker) {
|
||||
this.game = game;
|
||||
this.collisionChecker = collisionChecker;
|
||||
position = new Point(
|
||||
this.position = new Point(
|
||||
26 * GameMap.MAP_TILESIZE + GameMap.OFFSET_X,
|
||||
13 * GameMap.MAP_TILESIZE + GameMap.OFFSET_Y + (GameMap.MAP_TILESIZE / 2));
|
||||
this.startPosition = this.position;
|
||||
loadAnimation();
|
||||
}
|
||||
|
||||
@ -115,4 +117,16 @@ public class PacMan {
|
||||
public Point getTilePosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public double distanceTo(Point point) {
|
||||
return position.distance(point);
|
||||
}
|
||||
|
||||
public void loseLife() {
|
||||
|
||||
}
|
||||
|
||||
public void resetPosition() {
|
||||
position = startPosition;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user