Add enemy idle animation, stage for future close-up encounter anims
This commit is contained in:
parent
5286c60eff
commit
d4818c07a8
6 changed files with 97 additions and 1 deletions
20
assets/enemy-idle.atlas
Normal file
20
assets/enemy-idle.atlas
Normal file
|
@ -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
|
BIN
assets/enemy-idle.png
Normal file
BIN
assets/enemy-idle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 730 B |
27
assets/player-idle
Normal file
27
assets/player-idle
Normal file
|
@ -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
|
BIN
assets/stage.aseprite
Normal file
BIN
assets/stage.aseprite
Normal file
Binary file not shown.
BIN
assets/stage.png
Normal file
BIN
assets/stage.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
|
@ -3,12 +3,15 @@ package com.redstrate.watersymbol.screens;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Input;
|
import com.badlogic.gdx.Input;
|
||||||
import com.badlogic.gdx.Screen;
|
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.OrthographicCamera;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.graphics.g2d.Animation;
|
import com.badlogic.gdx.graphics.g2d.Animation;
|
||||||
import com.badlogic.gdx.graphics.g2d.Sprite;
|
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
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.TiledMap;
|
||||||
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
|
import com.badlogic.gdx.maps.tiled.TiledMapRenderer;
|
||||||
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
|
import com.badlogic.gdx.maps.tiled.TmxMapLoader;
|
||||||
|
@ -46,6 +49,8 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
Animation<TextureRegion> playerIdleAnimation;
|
Animation<TextureRegion> playerIdleAnimation;
|
||||||
|
|
||||||
|
Animation<TextureRegion> enemyIdleAnimation;
|
||||||
|
|
||||||
ArrowSpritesheet arrowSpritesheet;
|
ArrowSpritesheet arrowSpritesheet;
|
||||||
|
|
||||||
// data for in-turn actions
|
// data for in-turn actions
|
||||||
|
@ -62,6 +67,9 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
TextButton unitNameButton;
|
TextButton unitNameButton;
|
||||||
|
|
||||||
|
boolean currentlyParticipatingInStageEvent = false;
|
||||||
|
Texture stageTexture;
|
||||||
|
|
||||||
GameScreen(WaterSymbol game) {
|
GameScreen(WaterSymbol game) {
|
||||||
this.game = game;
|
this.game = game;
|
||||||
|
|
||||||
|
@ -78,6 +86,7 @@ public class GameScreen implements Screen {
|
||||||
playerTexture = new Texture(Gdx.files.internal("player.png"));
|
playerTexture = new Texture(Gdx.files.internal("player.png"));
|
||||||
playerSprite = new Sprite(playerTexture);
|
playerSprite = new Sprite(playerTexture);
|
||||||
playerIdleAnimation = new Animation<TextureRegion>(0.500f, new TextureAtlas("player-idle.atlas").getRegions(), Animation.PlayMode.LOOP_PINGPONG);
|
playerIdleAnimation = new Animation<TextureRegion>(0.500f, new TextureAtlas("player-idle.atlas").getRegions(), Animation.PlayMode.LOOP_PINGPONG);
|
||||||
|
enemyIdleAnimation = new Animation<TextureRegion>(0.500f, new TextureAtlas("enemy-idle.atlas").getRegions(), Animation.PlayMode.LOOP_PINGPONG);
|
||||||
|
|
||||||
arrowSpritesheet = new ArrowSpritesheet();
|
arrowSpritesheet = new ArrowSpritesheet();
|
||||||
cursorTexture = new Texture("cursor.png");
|
cursorTexture = new Texture("cursor.png");
|
||||||
|
@ -97,6 +106,8 @@ public class GameScreen implements Screen {
|
||||||
unitNameButton = new TextButton("<unit name>", style);
|
unitNameButton = new TextButton("<unit name>", style);
|
||||||
table.top().left().add(unitNameButton);
|
table.top().left().add(unitNameButton);
|
||||||
|
|
||||||
|
stageTexture = new Texture("stage.png");
|
||||||
|
|
||||||
startNewTeamTurn(Unit.Team.Player);
|
startNewTeamTurn(Unit.Team.Player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +363,13 @@ public class GameScreen implements Screen {
|
||||||
game.batch.setProjectionMatrix(camera.combined);
|
game.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
for(Unit unit : units) {
|
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) {
|
if(unit.hasTakenAction) {
|
||||||
game.batch.setColor(0.5f, 0.5f, 0.5f, 1.0f);
|
game.batch.setColor(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
|
@ -369,6 +386,38 @@ public class GameScreen implements Screen {
|
||||||
return;
|
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(currentTurnTeam == Unit.Team.Player) {
|
||||||
if(currentUnit == null) {
|
if(currentUnit == null) {
|
||||||
if (Gdx.input.isKeyPressed(Input.Keys.ENTER) || Gdx.input.isButtonPressed(0)) {
|
if (Gdx.input.isKeyPressed(Input.Keys.ENTER) || Gdx.input.isButtonPressed(0)) {
|
||||||
|
|
Reference in a new issue