From d21a4b8c1db674743b2d937bf213386a0b27dedf Mon Sep 17 00:00:00 2001 From: Matt Low Date: Thu, 2 Jan 2020 02:29:19 +0400 Subject: [PATCH] Add round clear flashing, closes #5 --- core/assets/level_background_win.png | Bin 0 -> 8090 bytes core/src/com/me/pacman/Assets.java | 5 ++++ core/src/com/me/pacman/state/PlayState.java | 24 +++++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 core/assets/level_background_win.png diff --git a/core/assets/level_background_win.png b/core/assets/level_background_win.png new file mode 100644 index 0000000000000000000000000000000000000000..1eb0f8f4e55f6bee988b5b6d2d4229c7fdfded88 GIT binary patch literal 8090 zcmV;LA7$W)P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3=CbsRmKh5sXp4FTSS1AES7u;K4>QB8_Y8htY> zN+Q)=T?M@68UQl;fB$vN|M0717fnp1=9aVNS8TEQ&JWc-zuNuV*?9lHzxL}b{{887 zbKXAWc`5KcJpU~Hb$#dc^y>p}m%H)#byHvO`1-oh>y5V?20hvH!}>T#UiZ)IF1~Km zUSrLzmXAXn{`o#%7v7<~{$yv%>t@eq`M3G_LM%jSB_0&K-@yfY|BlZ!;rY|~-3s_&W3L;l-EcI$fxPOeYf^wfIbJmyr%Xw`tLt|3BK>I*Ta`s=C>Q=pWkrl=iuKE ze|T_s{bYFg(;Kz8`E5F{Kj*A^&VFXsVNx{aEI!@F($exnGU1 zYP+4JeA#ISU(+?`$;vSPap1UH5A|cycvu7a>tj@!U~nV zO}|YDyzJk{;_h?Xecp7HCojjP-f=U>M}GTd{`BTQ`7-Ayw$9o5#EH6KTwW#0FqAp{ z%~d4Combw{4e;C7EB*FE{iswUmnqDZ33fZ4Ta4s>)mFH94qTV`{EF7m!OM;t2&>Wtin=m!~aDfz`9eGDOcQ+)M$HlHc(Uh9+3UN3`9BqD_z z3b|>aldKpM^;2S{hI$Gqrj&9jshZSM&mqU0a?T|SnrIuED4K>zOb1k*j zR(ta;fPtyyR$6VX_3lmQL7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HD5Fo&AFzQk4G=k4yc7Kl+QvGQI(@q;W@l&02@SX{>{AGS7cTJI7K*RcuS}H-A zCJSZRW6+NA2fj#htlvn)o_WG;^T+?Gjdf87(nz7Bu@v9IID_5;YNkkge< z&X610QcLIPzRu|lkXz{bEfJNL-8rEJbOaFK?|?B~IRrk^m2gW{bk_6LAywMNy&{vV zXfY+*mDc4BY9$F|rt8H(_3vxR{62N;at!&>rtJrq+2sh@&v>&Y$gN<@B^T2ua#P| o&+14^_E{ZjzW-&k-q+v$0YIm)0;Io7VE_OC07*qoM6N<$f(eMI82|tP literal 0 HcmV?d00001 diff --git a/core/src/com/me/pacman/Assets.java b/core/src/com/me/pacman/Assets.java index 358a125..fb985c3 100644 --- a/core/src/com/me/pacman/Assets.java +++ b/core/src/com/me/pacman/Assets.java @@ -38,6 +38,7 @@ public class Assets { public void loadAssets() { manager.load("level_background.png", Texture.class); + manager.load("level_background_win.png", Texture.class); manager.load("menu_background.png", Texture.class); manager.load("logo.png", Texture.class); @@ -105,6 +106,10 @@ public class Assets { return manager.get("level_background.png", Texture.class); } + public Texture getLevelWinBackground() { + return manager.get("level_background_win.png", Texture.class); + } + public Texture getMenuBackground() { return manager.get("menu_background.png", Texture.class); } diff --git a/core/src/com/me/pacman/state/PlayState.java b/core/src/com/me/pacman/state/PlayState.java index c0f704d..ee755ac 100644 --- a/core/src/com/me/pacman/state/PlayState.java +++ b/core/src/com/me/pacman/state/PlayState.java @@ -34,7 +34,7 @@ public class PlayState extends LevelState { Direction.DOWN, }; - private Texture levelBackground; + private Texture levelBackground, winBackground; private BitmapFont font; private TextureRegion lifeSprite; @@ -59,6 +59,8 @@ public class PlayState extends LevelState { private float newGameTimer; private float deathTimer; private float pointsTimer; + private float roundClearedTimer; + public float frightTimer; public float secondsSinceLastDot; @@ -82,6 +84,7 @@ public class PlayState extends LevelState { @Override public void setup() { levelBackground = game.assets.getLevelBackground(); + winBackground = game.assets.getLevelWinBackground(); font = game.assets.getFont(); lifeSprite = game.assets.pacman[2][1]; Gdx.input.setInputProcessor(new Controller()); @@ -91,7 +94,6 @@ public class PlayState extends LevelState { @Override public void render() { - game.batch.draw(levelBackground, 0, 16); level.render(0, 16); game.assets.getFont().setColor(Color.WHITE); @@ -106,6 +108,14 @@ public class PlayState extends LevelState { pacman.render(game.batch, 0, 16); } + if (roundClearedTimer > 0 && roundClearedTimer <= 2) { + // draw flashing level background + game.batch.draw((int) (roundClearedTimer * 4) % 2 == 0? levelBackground : winBackground, 0, 16); + return; + } else { + game.batch.draw(levelBackground, 0, 16); + } + if (pacman.alive && newGameTimer <= 0) { for (Ghost ghost : ghosts) { if (pointsTimer > 0 && ghost == lastGhostCaptured) { @@ -147,6 +157,14 @@ public class PlayState extends LevelState { return; } + if (roundClearedTimer > 0) { + roundClearedTimer -= dt; + if (roundClearedTimer <= 0) { + newRound(); + } + return; + } + if (gameOverTimer > 0) { gameOverTimer -= dt; if (gameOverTimer <= 0) { @@ -363,7 +381,7 @@ public class PlayState extends LevelState { secondsSinceLastDot = 0; if (pelletCount == 0) { - newRound(); + roundClearedTimer = 3f; } }