From 5eef40f7672f74d2e213f38bd8420844ad69c1fe Mon Sep 17 00:00:00 2001 From: Matt Low Date: Fri, 27 Dec 2019 15:45:34 +0400 Subject: [PATCH] Do the flashy thing --- core/src/com/me/pacman/entity/Ghost.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/com/me/pacman/entity/Ghost.java b/core/src/com/me/pacman/entity/Ghost.java index 6a02c90..469b706 100644 --- a/core/src/com/me/pacman/entity/Ghost.java +++ b/core/src/com/me/pacman/entity/Ghost.java @@ -54,7 +54,13 @@ public class Ghost extends MovableEntity { if (caught && !returned) { return null; } else if (state.frightTimer > 0 && !returned) { - return sprite[0][counter % 2]; + 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]; }