diff --git a/core/src/com/me/pacman/entity/Pacman.java b/core/src/com/me/pacman/entity/Pacman.java index e75a86f..a073885 100644 --- a/core/src/com/me/pacman/entity/Pacman.java +++ b/core/src/com/me/pacman/entity/Pacman.java @@ -1,7 +1,6 @@ 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 { @@ -61,6 +60,10 @@ public class Pacman extends MovableEntity { state.eatPellet(x, y); freezeFrames = 1; break; + case POWER_PELLET: + state.eatPowerPellet(x, y); + freezeFrames = 3; + break; } } diff --git a/core/src/com/me/pacman/state/PlayState.java b/core/src/com/me/pacman/state/PlayState.java index f8caf35..abfeaed 100644 --- a/core/src/com/me/pacman/state/PlayState.java +++ b/core/src/com/me/pacman/state/PlayState.java @@ -90,7 +90,7 @@ public class PlayState extends LevelState { lives--; } - public void eatPellet(float x, float y) { + private void pelletEaten(float x, float y) { level.setTile(x, y, LevelTile.EMPTY); if (pelletEatenCount % 2 == 0) { game.assets.chomp_1.play(1.0f); @@ -99,9 +99,19 @@ public class PlayState extends LevelState { } pelletEatenCount++; pelletCount--; + } + + public void eatPellet(float x, float y) { + pelletEaten(x, y); score += 10; } + public void eatPowerPellet(float x, float y) { + pelletEaten(x, y); + // TODO: Enable ghost chase mode + score += 50; + } + @Override public void dispose() { Gdx.input.setInputProcessor(null);