From a55410c122e0a7d46b0bf1db8ab78d033b7d2f21 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 2 May 2022 16:42:55 -0400 Subject: [PATCH] Update some graphics There's now a proper idle animation for units (although only the player has one at the moment). The new tilemap size is 16x16 and everything has been adjusted for it. --- assets/main.tsx | 53 ++++++++++--- assets/player-idle.atlas | 27 +++++++ assets/player-idle.png | Bin 0 -> 889 bytes assets/test.tmx | 74 ++++++++++++------ assets/world-map.png | Bin 0 -> 1695 bytes .../watersymbol/screens/GameScreen.java | 50 +++++++----- 6 files changed, 153 insertions(+), 51 deletions(-) create mode 100644 assets/player-idle.atlas create mode 100644 assets/player-idle.png create mode 100644 assets/world-map.png diff --git a/assets/main.tsx b/assets/main.tsx index 7649ac0..57890e4 100644 --- a/assets/main.tsx +++ b/assets/main.tsx @@ -1,16 +1,49 @@ - - - - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/player-idle.atlas b/assets/player-idle.atlas new file mode 100644 index 0000000..d7f7676 --- /dev/null +++ b/assets/player-idle.atlas @@ -0,0 +1,27 @@ + +player-idle.png +size: 64, 32 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +player-idle1 + rotate: false + xy: 2, 2 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 +player-idle2 + rotate: false + xy: 38, 2 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 +player-idle3 + rotate: false + xy: 20, 2 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 diff --git a/assets/player-idle.png b/assets/player-idle.png new file mode 100644 index 0000000000000000000000000000000000000000..dd64d845709ab09a38f80a30a95ec2969a309d80 GIT binary patch literal 889 zcmV-<1BU#GP)5I`QDjgdMO2uTmHi;dip+>C2wa5GLM&PZ zE!?y$4B8|?(4rP?YMS2nI_GlVdH20J@9FY=;c(yFx%cxu=e#>_W|Rui_VT)-Arar> z3W@k0S1g$TYbdJ?7`P%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,5,5,5,5,5,5,5,5,5 diff --git a/assets/world-map.png b/assets/world-map.png new file mode 100644 index 0000000000000000000000000000000000000000..6ee3176d14ccd99f6542bdabd34d31b19f105e6f GIT binary patch literal 1695 zcmV;Q24MM#P)Px*SxH1eRA_;{T3=`!MHv6xW$!d+8_C54a@ORoNZPYWNZL^Ds!-Ze;UH}V8-4LX zDiV}h=u1HiSfTjf%R%v_DD|Z;B@vVq4jU2`!B&aMB~6J1@iwvEHKcb*)8ryuoAY5a zo0-|!KexN}_mZ2L@0;&8-=CS;-T2-g>#D#74s|CnQ!Y5x_q#C;z?JcaK*>D;e!})p zv*8$zq7wF&Kv4-BdZeg?nKmIRc}c)78UiKEl-1v!cz}01-4=y}_J$_}c(;>wd#Kqm zNj=R09(F3k^D3woo)KsdHS02+AAh0*tlZ6y6GBfk2h27lLdZ1%J4SeTT80JXwxtm> zxF%rNkO-a~Mn++FN6^)Ilo6);ZajNf82h@wD#B8WZBj)gyhR}SU<}#m5yl`7(wFQU!?n;!-S~>K z4J(SZ@pvkt9aItk^p=N^ogTr$R2IPpR{;QfI`(05{zc&gSpdDALqZaEFq_F^7J0-| z5%xktj1zRX{DEInMW%0mrU7|$F@4e6FynT*&5sd~B$NQXyK~9`;MULB)3J}~f95k8 zw;^Ls2aufxkWl-119puAn^i!PYqGEt01ykP#;;soViYF}I}z9&!IkSvx+E3BC>dun zd6ob{ck`c&;9IZOTNAK?gP=$RvdHpM3AV|{d|@gJB!JSt^8oa*H_M0FOrG5bl>T3^ za0#e8ox#fIDItM{sV$0ir!!CzVM{|sh^Hd>{ksBQ?tMys95)0?rk4zUd^VFe41*Z~ z0%>h@9rKU)Y|q0STjMRkddTY~ZBp93MxZw$NpIXfw%4p;{*iuCQJW@6>-*mLa({*H zsIPfJ;1PA~;bZf7JJDzMfrpQ`36;qhjh3K(n|7k_==}igdbj$1nhnoRGzM6EqZ)lb z0G-=NyCqm}=u(lq6MfUOz)gkN)n^E7ud#ogi{M0GBhV78H!U+!EctOK`WgW%ck$!= zgiiHMbHIqTT1M9KwWIHMVuW_JTYdl1%P(tlbAF7Q`y)pi( zr~6*u_C7$2PmB)Za{3H<%R`zch;hf(1H@}iq zQz3L10N`@^3{IWBsFC19L!heyH#-{vZH&ZwVsseG_wO-sO*8@3-Nuueg@de~U*+ZW z87$wwhqm+v_8#eHl8-)=Hlo%()su6B>b7t&=);!i27UPPQH5DGAx8ds zVO%3XVooNPPq0F?apEbj;0J)lT~TdvVxVUrhC|&+M88!%@}!{Uz`>vo^5*Zk!3yS( z!#Hw`aYD{ZFEBYUH(1f!-7^pa0IZ#hV(na18zmQCtX0M%#Vhune pfX0C>;n?{ka_4VoZ7&X^{{WWJXAMGN_h|qC002ovPDHLkV1nIb9994T literal 0 HcmV?d00001 diff --git a/core/src/com/redstrate/watersymbol/screens/GameScreen.java b/core/src/com/redstrate/watersymbol/screens/GameScreen.java index 04bbebd..c7c20c7 100644 --- a/core/src/com/redstrate/watersymbol/screens/GameScreen.java +++ b/core/src/com/redstrate/watersymbol/screens/GameScreen.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.Input; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; +import com.badlogic.gdx.graphics.g2d.Animation; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -37,6 +38,8 @@ public class GameScreen implements Screen { Texture playerTexture; Sprite playerSprite; + Animation playerIdleAnimation; + TextureAtlas arrowAtlas; // data for in-turn actions @@ -50,40 +53,42 @@ public class GameScreen implements Screen { camera = new OrthographicCamera(); camera.setToOrtho(false, 800, 480); + camera.zoom = 2.0f; tiledMap = new TmxMapLoader().load("test.tmx"); tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap); Unit player = new Unit(); - player.positionX = 1; - player.positionY = 1; + player.positionX = 11; + player.positionY = 16; player.team = Unit.Team.Player; units.add(player); Unit player2 = new Unit(); - player2.positionX = 1; - player2.positionY = 5; + player2.positionX = 11; + player2.positionY = 20; player2.team = Unit.Team.Player; units.add(player2); Unit enemy = new Unit(); - enemy.positionX = 5; - enemy.positionY = 1; + enemy.positionX = 15; + enemy.positionY = 18; enemy.team = Unit.Team.Enemy; units.add(enemy); Unit enemy2 = new Unit(); enemy2.positionX = 15; - enemy2.positionY = 15; + enemy2.positionY = 18; enemy2.team = Unit.Team.Enemy; units.add(enemy2); playerTexture = new Texture(Gdx.files.internal("player.png")); playerSprite = new Sprite(playerTexture); + playerIdleAnimation = new Animation(0.500f, new TextureAtlas("player-idle.atlas").getRegions(), Animation.PlayMode.LOOP_PINGPONG); arrowAtlas = new TextureAtlas("test.atlas"); @@ -113,7 +118,9 @@ public class GameScreen implements Screen { getNextUnit(); - smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 32, currentUnit.positionY * 32, 0)); + if(currentUnit != null) { + smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0)); + } } void updateUnits() { @@ -155,7 +162,7 @@ public class GameScreen implements Screen { startNewTeamTurn(Unit.Team.Player); } } else { - smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 32, currentUnit.positionY * 32, 0)); + smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0)); } } @@ -242,9 +249,12 @@ public class GameScreen implements Screen { currentlyTransitionCamera = true; } + private float stateTime = 0.0f; + @Override public void render(float delta) { ScreenUtils.clear(0, 0, 0.2f, 1); + stateTime += delta; if(currentlyTransitionCamera) { camera.position.set(oldCameraPosition.lerp(targetCameraPosition, lerp)); @@ -263,8 +273,9 @@ public class GameScreen implements Screen { game.batch.setProjectionMatrix(camera.combined); for(Unit unit : units) { - playerSprite.setPosition(unit.positionX * 32, unit.positionY * 32); - playerSprite.draw(game.batch); + TextureRegion currentFrame = playerIdleAnimation.getKeyFrame(stateTime, true); + + game.batch.draw(currentFrame, unit.positionX * 16, unit.positionY * 16); } // early exit, since we want the camera to finish its nice transition @@ -285,8 +296,8 @@ public class GameScreen implements Screen { double newX = Math.floor(mousePos.x); double newY = Math.floor(mousePos.y); - int newFixedX = (int) (newX / 32.0); - int newFixedY = (int) (newY / 32.0); + int newFixedX = (int) (newX / 16.0); + int newFixedY = (int) (newY / 16.0); ArrayList path = AStar.path(new Vector2(currentUnit.positionX, currentUnit.positionY), new Vector2((float) newFixedX, (float) newFixedY), getCollision(), tiledMap); if (path != null) { @@ -336,7 +347,7 @@ public class GameScreen implements Screen { } if (spriteRegion != null) { - game.batch.draw(spriteRegion, newPosition.x * 32, newPosition.y * 32); + game.batch.draw(spriteRegion, newPosition.x * 16, newPosition.y * 16); } } } @@ -348,7 +359,7 @@ public class GameScreen implements Screen { double newX = Math.floor(mousePos.x); double newY = Math.floor(mousePos.y); - moveUnitTo((int) (newX / 32.0), (int) (newY / 32.0)); + moveUnitTo((int) (newX / 16.0), (int) (newY / 16.0)); hasStartedMoving = false; } @@ -397,7 +408,7 @@ public class GameScreen implements Screen { currentUnit.positionX = (int) nextMove.x; currentUnit.positionY = (int) nextMove.y; - smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 32, currentUnit.positionY * 32, 0)); + smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0)); } else { currentlyTakingAction = false; currentlyAwaitingAuxilaryAction = true; @@ -434,8 +445,8 @@ public class GameScreen implements Screen { double newX = Math.floor(mousePos.x); double newY = Math.floor(mousePos.y); - int newFixedX = (int) (newX / 32.0); - int newFixedY = (int) (newY / 32.0); + int newFixedX = (int) (newX / 16.0); + int newFixedY = (int) (newY / 16.0); List actions = getAvailableActionsForPosition(newFixedX, newFixedY); for (int i = 0; i < actions.size(); i++) { @@ -454,7 +465,8 @@ public class GameScreen implements Screen { @Override public void resize(int width, int height) { - camera.setToOrtho(false, width, height); + camera.viewportWidth = 230; + camera.viewportHeight = 230 * ((float)height / (float)width); } @Override