Do the flashy thing

This commit is contained in:
Matt Low 2019-12-27 15:45:34 +04:00
parent cd2b968631
commit 5eef40f767

View File

@ -54,7 +54,13 @@ public class Ghost extends MovableEntity {
if (caught && !returned) {
return null;
} else if (state.frightTimer > 0 && !returned) {
if (state.frightTimer > 2) {
// Render the blue scared ghost
return sprite[0][counter % 2];
} else {
// Render the flashing white ghost
return sprite[0][(int) (state.frightTimer * 5) % 2 == 0? 2 : 0 + counter % 2];
}
} else {
return sprite[2 + (counter % 2)][spriteIndex];
}