diff --git a/assets/enemy-idle.atlas b/assets/enemy-idle.atlas new file mode 100644 index 0000000..5ab3e93 --- /dev/null +++ b/assets/enemy-idle.atlas @@ -0,0 +1,20 @@ + +enemy-idle.png +size: 64, 32 +format: RGBA8888 +filter: Nearest, Nearest +repeat: none +Sprite-0009 + rotate: false + xy: 20, 2 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 +Sprite-0010 + rotate: false + xy: 2, 2 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 diff --git a/assets/enemy-idle.png b/assets/enemy-idle.png new file mode 100644 index 0000000..d2eb884 Binary files /dev/null and b/assets/enemy-idle.png differ diff --git a/assets/player-idle b/assets/player-idle new file mode 100644 index 0000000..d7f7676 --- /dev/null +++ b/assets/player-idle @@ -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/stage.aseprite b/assets/stage.aseprite new file mode 100644 index 0000000..050309e Binary files /dev/null and b/assets/stage.aseprite differ diff --git a/assets/stage.png b/assets/stage.png new file mode 100644 index 0000000..037c65e Binary files /dev/null and b/assets/stage.png differ diff --git a/core/src/com/redstrate/watersymbol/screens/GameScreen.java b/core/src/com/redstrate/watersymbol/screens/GameScreen.java index 540ab62..8218278 100644 --- a/core/src/com/redstrate/watersymbol/screens/GameScreen.java +++ b/core/src/com/redstrate/watersymbol/screens/GameScreen.java @@ -3,12 +3,15 @@ package com.redstrate.watersymbol.screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.graphics.GL20; 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; +import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.maps.tiled.TiledMapRenderer; import com.badlogic.gdx.maps.tiled.TmxMapLoader; @@ -46,6 +49,8 @@ public class GameScreen implements Screen { Animation playerIdleAnimation; + Animation enemyIdleAnimation; + ArrowSpritesheet arrowSpritesheet; // data for in-turn actions @@ -62,6 +67,9 @@ public class GameScreen implements Screen { TextButton unitNameButton; + boolean currentlyParticipatingInStageEvent = false; + Texture stageTexture; + GameScreen(WaterSymbol game) { this.game = game; @@ -78,6 +86,7 @@ public class GameScreen implements Screen { 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); + enemyIdleAnimation = new Animation(0.500f, new TextureAtlas("enemy-idle.atlas").getRegions(), Animation.PlayMode.LOOP_PINGPONG); arrowSpritesheet = new ArrowSpritesheet(); cursorTexture = new Texture("cursor.png"); @@ -97,6 +106,8 @@ public class GameScreen implements Screen { unitNameButton = new TextButton("", style); table.top().left().add(unitNameButton); + stageTexture = new Texture("stage.png"); + startNewTeamTurn(Unit.Team.Player); } @@ -352,7 +363,13 @@ public class GameScreen implements Screen { game.batch.setProjectionMatrix(camera.combined); for(Unit unit : units) { - TextureRegion currentFrame = playerIdleAnimation.getKeyFrame(stateTime, true); + + TextureRegion currentFrame = null; + if(unit.team == Unit.Team.Player) { + currentFrame = playerIdleAnimation.getKeyFrame(stateTime, true); + } else { + currentFrame = enemyIdleAnimation.getKeyFrame(stateTime, true); + } if(unit.hasTakenAction) { game.batch.setColor(0.5f, 0.5f, 0.5f, 1.0f); @@ -369,6 +386,38 @@ public class GameScreen implements Screen { return; } + if(currentlyParticipatingInStageEvent) { + game.batch.end(); + + Gdx.gl.glEnable(GL20.GL_BLEND); + Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); + + ShapeRenderer renderer = new ShapeRenderer(); + renderer.begin(ShapeRenderer.ShapeType.Filled); + renderer.set(ShapeRenderer.ShapeType.Filled); + renderer.setProjectionMatrix(camera.combined); + renderer.rect( + camera.position.x - camera.viewportWidth, + camera.position.y - camera.viewportHeight, + camera.viewportWidth * 2, + camera.viewportHeight * 2, + new Color(0.0f, 0.0f, 0.0f, 0.5f), + new Color(0.0f, 0.0f, 0.0f, 0.5f), + new Color(0.0f, 0.0f, 0.0f, 0.5f), + new Color(0.0f, 0.0f, 0.0f, 0.5f) + ); + renderer.end(); + + game.batch.begin(); + + game.batch.setColor(1.0f, 1.0f, 1.0f, 1.0f); + game.batch.draw(stageTexture, camera.position.x - stageTexture.getWidth() / 2, camera.position.y - stageTexture.getHeight() / 2); + + game.batch.end(); + + return; + } + if(currentTurnTeam == Unit.Team.Player) { if(currentUnit == null) { if (Gdx.input.isKeyPressed(Input.Keys.ENTER) || Gdx.input.isButtonPressed(0)) {