diff --git a/core/src/com/me/pacman/entity/Pacman.java b/core/src/com/me/pacman/entity/Pacman.java index a073885..bd50d15 100644 --- a/core/src/com/me/pacman/entity/Pacman.java +++ b/core/src/com/me/pacman/entity/Pacman.java @@ -1,6 +1,7 @@ package com.me.pacman.entity; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.me.pacman.level.LevelTile; import com.me.pacman.state.PlayState; public class Pacman extends MovableEntity { @@ -21,7 +22,7 @@ public class Pacman extends MovableEntity { @Override public TextureRegion getSprite() { if (!moving) { - return sprite[0][0]; + return sprite[2][0]; } int spriteDir; @@ -55,7 +56,12 @@ public class Pacman extends MovableEntity { counter += 1; } - switch (state.level.getTile(x, y)) { + LevelTile tile = state.level.getTile(x, y); + if (tile == null) { + return; + } + + switch (tile) { case PELLET: state.eatPellet(x, y); freezeFrames = 1;