From 35468417a48fdb238091a69433b5009853cbe533 Mon Sep 17 00:00:00 2001 From: Ritchie Cunningham Date: Wed, 9 Mar 2022 22:41:34 +0000 Subject: [PATCH] [Add] New animation type. --- bin/tfg/AnimatedSprite.class | Bin 3651 -> 3944 bytes bin/tfg/AnimationType.class | Bin 0 -> 1014 bytes bin/tfg/Game.class | Bin 5852 -> 5852 bytes bin/tfg/Player.class | Bin 3493 -> 3581 bytes src/tfg/AnimatedSprite.java | 40 ++++++++++++++++++++--------------- src/tfg/AnimationType.java | 7 ++++++ src/tfg/Game.java | 1 + src/tfg/Player.java | 19 +++++++++-------- src/tfg/Tile.java | 2 +- 9 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 bin/tfg/AnimationType.class create mode 100644 src/tfg/AnimationType.java diff --git a/bin/tfg/AnimatedSprite.class b/bin/tfg/AnimatedSprite.class index 16c2a1222b0557134a388c53f50d511fa800a700..7287744b73f3b6dedd80b288c5c02ba31a397bff 100644 GIT binary patch literal 3944 zcmaJ@`&U%g75?r#7#J?EQG5inM8Gfu5u&kZ5e1Qv(E$uIf@rJ^aDj_3GrcnywU5|5 zXp%P7q}5uDrm05K)V4(B(U_Ir+SS$m3;m_P_YdgGYLkBZ-pkCuS~_dpd(J-h?0vqy z_qX?%zkmJtmjGJvg$E7=zVz65V|!emj-|EHNYc>Lng=cgrIWF9vBs%be7v!Dcv2fl zD=3bc+w?>{lGLakOFl~<{gQdcv>^K zCuJUXERoXFG^wB>oG`{4CsSk7Q;n$$skAoT*w1ql#?G;pjL8*@tGACEvE+n4l4`UZ z;PwJ7p4QVB!if>8hQ&utV{#Bbdaa`)`b9!}^07L%t{<5(4BE0HMD^%}B$d{gCRZ(T zb45*LAQbKBIumU_81Ag$sWpdmgFcx4IZiPMdHeLZp5CvZp)SYWwfI*9_V+7rbtFbL zFPx}Uu?brgIP3iV1q}7KRJf5Rvu9Nlz$>$A6@~D6P^)0`6JzQ{4W1KYbqd^d!JuU> zph88F2MteA)xD_44pD6s)lk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ZyKIwJNvB`4Qhv*>aE;C8 zeNyNH*2+f=;W|UOfgyZC!rin(ahRWVL#g4UI@ue&?)64fFb%tNb;si}LZWusHb-`0h;H#|Pj3 zJ#-@W6+R|xfe|uwg2Ept_*R8KQt+<|pHc`q!sORjyhCUs>k=*xwXx diff --git a/bin/tfg/AnimationType.class b/bin/tfg/AnimationType.class new file mode 100644 index 0000000000000000000000000000000000000000..eaed7b29b8b6bc477bf0e4074d2756db3e433223 GIT binary patch literal 1014 zcmZ`%-*3`T7(JH)1y(l(6CF(Fk4>PPLrnAqT-GdT$hwkPh9N$ff*p2&vXruf|4P}z z7LAL~{!zy7c6HQU7xchCL#>+2POS9mTW#IWoh_ezRw4Gh;B+Re$SDI(0U zcw(FxrM_YJN;P{tU($*@q4eap7oT?V00Y*D-Y;YTxuNCFH=3Cl<^M5{g}Q&4C2bl0)$UZq}a z#fiHjA%bWOA_sRQh#bT?$V!MI%D>hm#E~Gcs%4wnc+fGOrqSt}3@LTkHTo^Xu{icN z6A+LjKkg@ML>A7B{@A3COrbb$k_0yJM8qbU4mg~QTyr2Hj{-y7a2#XO9iC1YoVCd&DYc+ObAx`PZzJ^R3uAfLT V`4U?{!2Vws!j7j|!ZU9z{|5cf&w>B| literal 0 HcmV?d00001 diff --git a/bin/tfg/Game.class b/bin/tfg/Game.class index d4c6755b539e3ade6501a2b8f0ccd62603a5234b..afb18022445a75c8fb99dad42cdedb1acd8926c0 100644 GIT binary patch delta 235 zcmWNL&1=B{7=RyZEH}bsB?lKJb5hD-4%!aBC*&imu_;OsO%7ZzjFoLpi7ya z*gkEZ7)fBpkXNBK&+HiU!-QXn{xem)hKYL484Kml&@nHC-Z1fwl@Bgh;o=i7U-IJj JwqmTD909ZkHGKd8 delta 235 zcmWNL&uf7J9L7Inv>TbrN;~YL^v+4C9XODK*%rN;Ey|c;B_eB=Ij|pWq+YR;*l=)K zDQACx!{X|X@x47yPoK~CyHj?`pK8_xw3zun9>Tx{M#3C&iG?eUx#olj4pf}P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>APPOnvS{HGL zDI$6`D1eo1YFbA5I#p6S>33iq%UO9Z38tCbz;s<8>ykhsRAc48(LodC#;LrQB)Ez} zu6lcFSQv^I&xzdwHGJs`c9JKTgeOKsPNr*kKmY&$ diff --git a/src/tfg/AnimatedSprite.java b/src/tfg/AnimatedSprite.java index d0fe7d2..a05794b 100644 --- a/src/tfg/AnimatedSprite.java +++ b/src/tfg/AnimatedSprite.java @@ -22,10 +22,7 @@ public class AnimatedSprite { * Keeps track of time between frame changes. */ private int frameCounter = 0; - /** - * Whether or not the sprite is currently animated. - */ - private boolean animating = false; + /** * The position at which the sprite is rendered. */ @@ -43,6 +40,11 @@ public class AnimatedSprite { */ private final Vector2i spriteSize = new Vector2i(32, 48); + /** + * The current animation to play. + */ + private AnimationType currentAnimationType = AnimationType.NONE; + /** * Create a new animated sprite. * @param s The sprite to animate. @@ -53,21 +55,14 @@ public class AnimatedSprite { entityLoc = l; } - /** - * Start the animation. - */ - public void startWalkingAnimation() { - startAnimation(); - } - /** * Update animation. */ public void animate() { - if(animating) { /* Then update animation. */ + if(currentAnimationType != AnimationType.NONE) { if(frameCounter >= animationSpeed) { /* If 15Hz has passed. */ stopAnimation(); - } else { + } else if(currentAnimationType == AnimationType.WALKING) { /* Get the position between old and new. */ spritePosition = entityLoc.interpolate(animationSpeed, frameCounter); Vector2i entityPos = entityLoc.getPosition(); /* Get the entity position. */ @@ -86,6 +81,17 @@ public class AnimatedSprite { } else if(change >= .75f && change <= 1.0f) { animationFrame = 3; } + } else if(currentAnimationType== AnimationType.STATIONARY_WALK) { + float steps = animationSpeed / 4; + if(frameCounter >= 0.f && frameCounter < steps) { + animationFrame = 0; + } else if(frameCounter >= steps && frameCounter < (2*steps)) { + animationFrame = 1; + } else if(frameCounter >= (2*steps)&&frameCounter<(3*steps)) { + animationFrame = 2; + } else if(frameCounter >= (3*steps)&&frameCounter<=(4*steps)) { + animationFrame = 3; + } } frameCounter++; /* Increment on each update to keep track of time. */ } @@ -96,7 +102,7 @@ public class AnimatedSprite { */ private void stopAnimation() { /* Reset the following. */ - animating = false; + currentAnimationType = AnimationType.NONE; frameCounter = 0; animationFrame = 0; } @@ -104,8 +110,8 @@ public class AnimatedSprite { /** * Start the animation. */ - private void startAnimation() { - animating = true; + public void startAnimation(AnimationType t) { + currentAnimationType = t; } /** @@ -113,7 +119,7 @@ public class AnimatedSprite { * @return If the animation finished. */ public boolean finishedAnimating() { - return !animating; + return currentAnimationType == AnimationType.NONE; } /** diff --git a/src/tfg/AnimationType.java b/src/tfg/AnimationType.java new file mode 100644 index 0000000..b963ccb --- /dev/null +++ b/src/tfg/AnimationType.java @@ -0,0 +1,7 @@ +package tfg; + +public enum AnimationType { + NONE, + WALKING, + STATIONARY_WALK +}; diff --git a/src/tfg/Game.java b/src/tfg/Game.java index 07c66f3..a7312ee 100644 --- a/src/tfg/Game.java +++ b/src/tfg/Game.java @@ -66,6 +66,7 @@ public class Game { windowTitle); player.changeMap(new Map(10, 10, Tile.SAND)); camera = new Camera(window); + // window.setFramerateLimit(60); } /** diff --git a/src/tfg/Player.java b/src/tfg/Player.java index 95856bd..6f18cd2 100644 --- a/src/tfg/Player.java +++ b/src/tfg/Player.java @@ -17,10 +17,6 @@ import java.nio.file.Paths; * @author Ritchie Cunningham */ public class Player extends Entity implements Drawable { - /** - * The players location. - */ - private Location playerLoc; /** * The texture for the sprite. */ @@ -104,9 +100,14 @@ public class Player extends Entity implements Drawable { entityLoc.setDirection(d); if(currentMap.isValidLocation(newLoc)) { currentAction = PlayerAction.MOVING; - entityLoc.setDirection(d); - playerSprite.startWalkingAnimation(); + playerSprite.startAnimation(AnimationType.WALKING); } else if(cannotMove.getStatus() == SoundSource.Status.STOPPED) { + /* + * Play the stationary walk animation. + * It appears like the player is trying to move, but can't. + */ + playerSprite.startAnimation(AnimationType.STATIONARY_WALK); + /* Play an annoying sound. */ cannotMove.play(); } } @@ -123,11 +124,11 @@ public class Player extends Entity implements Drawable { /* Actually move the location. */ entityLoc = entityLoc.getRelativeLocation(entityLoc.getDirection()); /* Update the sprite with new location. */ - playerSprite.updatePosition(entityLoc); - } else { - playerSprite.animate(); /* Proceed with the animation. */ + playerSprite.updatePosition(entityLoc); } } + /* Update the animation, if there is no current animation, ignore. */ + playerSprite.animate(); } /** diff --git a/src/tfg/Tile.java b/src/tfg/Tile.java index b77964a..05a14f0 100644 --- a/src/tfg/Tile.java +++ b/src/tfg/Tile.java @@ -20,7 +20,7 @@ public enum Tile { /** * Get the coords of a specific tile from the tile-set image. - * @param t The tole to get the coordinates of. + * @param t The tile to get the coordinates of. * @return Coords of the tile image in the tile-set. */ public static Vector2f getTextureCoords(Tile t) {