Eat power pellets.
This commit is contained in:
parent
e038db9500
commit
fd30774746
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user