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.
This commit is contained in:
parent
209f3d4d3b
commit
a55410c122
6 changed files with 153 additions and 51 deletions
|
@ -1,16 +1,49 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<tileset version="1.8" tiledversion="1.8.4" name="main" tilewidth="32" tileheight="32" tilecount="2" columns="0">
|
<tileset version="1.8" tiledversion="1.8.4" name="world-map" tilewidth="16" tileheight="16" tilecount="10" columns="2">
|
||||||
<grid orientation="orthogonal" width="1" height="1"/>
|
<image source="../../world-map.png" width="32" height="80"/>
|
||||||
<tile id="0" type="grass">
|
<tile id="0" type="null">
|
||||||
<properties>
|
|
||||||
<property name="walkable" type="bool" value="true"/>
|
|
||||||
</properties>
|
|
||||||
<image width="32" height="32" source="grass.png"/>
|
|
||||||
</tile>
|
|
||||||
<tile id="1" type="fake grass (real)">
|
|
||||||
<properties>
|
<properties>
|
||||||
<property name="walkable" type="bool" value="false"/>
|
<property name="walkable" type="bool" value="false"/>
|
||||||
</properties>
|
</properties>
|
||||||
<image width="32" height="32" source="grass.png"/>
|
</tile>
|
||||||
|
<tile id="1" type="grass">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="2" type="village">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="3" type="background">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="4" type="background">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="5" type="background">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="6" type="background">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="false"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="7" type="mountain">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</tile>
|
||||||
|
<tile id="8" type="forest">
|
||||||
|
<properties>
|
||||||
|
<property name="walkable" type="bool" value="true"/>
|
||||||
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
</tileset>
|
</tileset>
|
||||||
|
|
27
assets/player-idle.atlas
Normal file
27
assets/player-idle.atlas
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/player-idle.png
Normal file
BIN
assets/player-idle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 889 B |
|
@ -1,28 +1,58 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.8" tiledversion="1.8.4" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="32" tileheight="32" infinite="0" nextlayerid="3" nextobjectid="6">
|
<map version="1.8" tiledversion="1.8.4" orientation="orthogonal" renderorder="right-down" width="50" height="50" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6">
|
||||||
<tileset firstgid="1" source="main.tsx"/>
|
<tileset firstgid="1" source="main.tsx"/>
|
||||||
<layer id="1" name="Tile Layer 1" width="30" height="20">
|
<layer id="1" name="Tile Layer 1" width="50" height="50">
|
||||||
<data encoding="csv">
|
<data encoding="csv">
|
||||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5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,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||||
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
|
||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
</map>
|
</map>
|
||||||
|
|
BIN
assets/world-map.png
Normal file
BIN
assets/world-map.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.Input;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
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.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;
|
||||||
|
@ -37,6 +38,8 @@ public class GameScreen implements Screen {
|
||||||
Texture playerTexture;
|
Texture playerTexture;
|
||||||
Sprite playerSprite;
|
Sprite playerSprite;
|
||||||
|
|
||||||
|
Animation<TextureRegion> playerIdleAnimation;
|
||||||
|
|
||||||
TextureAtlas arrowAtlas;
|
TextureAtlas arrowAtlas;
|
||||||
|
|
||||||
// data for in-turn actions
|
// data for in-turn actions
|
||||||
|
@ -50,40 +53,42 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
camera = new OrthographicCamera();
|
camera = new OrthographicCamera();
|
||||||
camera.setToOrtho(false, 800, 480);
|
camera.setToOrtho(false, 800, 480);
|
||||||
|
camera.zoom = 2.0f;
|
||||||
|
|
||||||
tiledMap = new TmxMapLoader().load("test.tmx");
|
tiledMap = new TmxMapLoader().load("test.tmx");
|
||||||
tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
|
tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
|
||||||
|
|
||||||
Unit player = new Unit();
|
Unit player = new Unit();
|
||||||
player.positionX = 1;
|
player.positionX = 11;
|
||||||
player.positionY = 1;
|
player.positionY = 16;
|
||||||
player.team = Unit.Team.Player;
|
player.team = Unit.Team.Player;
|
||||||
|
|
||||||
units.add(player);
|
units.add(player);
|
||||||
|
|
||||||
Unit player2 = new Unit();
|
Unit player2 = new Unit();
|
||||||
player2.positionX = 1;
|
player2.positionX = 11;
|
||||||
player2.positionY = 5;
|
player2.positionY = 20;
|
||||||
player2.team = Unit.Team.Player;
|
player2.team = Unit.Team.Player;
|
||||||
|
|
||||||
units.add(player2);
|
units.add(player2);
|
||||||
|
|
||||||
Unit enemy = new Unit();
|
Unit enemy = new Unit();
|
||||||
enemy.positionX = 5;
|
enemy.positionX = 15;
|
||||||
enemy.positionY = 1;
|
enemy.positionY = 18;
|
||||||
enemy.team = Unit.Team.Enemy;
|
enemy.team = Unit.Team.Enemy;
|
||||||
|
|
||||||
units.add(enemy);
|
units.add(enemy);
|
||||||
|
|
||||||
Unit enemy2 = new Unit();
|
Unit enemy2 = new Unit();
|
||||||
enemy2.positionX = 15;
|
enemy2.positionX = 15;
|
||||||
enemy2.positionY = 15;
|
enemy2.positionY = 18;
|
||||||
enemy2.team = Unit.Team.Enemy;
|
enemy2.team = Unit.Team.Enemy;
|
||||||
|
|
||||||
units.add(enemy2);
|
units.add(enemy2);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
arrowAtlas = new TextureAtlas("test.atlas");
|
arrowAtlas = new TextureAtlas("test.atlas");
|
||||||
|
|
||||||
|
@ -113,7 +118,9 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
getNextUnit();
|
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() {
|
void updateUnits() {
|
||||||
|
@ -155,7 +162,7 @@ public class GameScreen implements Screen {
|
||||||
startNewTeamTurn(Unit.Team.Player);
|
startNewTeamTurn(Unit.Team.Player);
|
||||||
}
|
}
|
||||||
} else {
|
} 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;
|
currentlyTransitionCamera = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float stateTime = 0.0f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
ScreenUtils.clear(0, 0, 0.2f, 1);
|
ScreenUtils.clear(0, 0, 0.2f, 1);
|
||||||
|
stateTime += delta;
|
||||||
|
|
||||||
if(currentlyTransitionCamera) {
|
if(currentlyTransitionCamera) {
|
||||||
camera.position.set(oldCameraPosition.lerp(targetCameraPosition, lerp));
|
camera.position.set(oldCameraPosition.lerp(targetCameraPosition, lerp));
|
||||||
|
@ -263,8 +273,9 @@ public class GameScreen implements Screen {
|
||||||
game.batch.setProjectionMatrix(camera.combined);
|
game.batch.setProjectionMatrix(camera.combined);
|
||||||
|
|
||||||
for(Unit unit : units) {
|
for(Unit unit : units) {
|
||||||
playerSprite.setPosition(unit.positionX * 32, unit.positionY * 32);
|
TextureRegion currentFrame = playerIdleAnimation.getKeyFrame(stateTime, true);
|
||||||
playerSprite.draw(game.batch);
|
|
||||||
|
game.batch.draw(currentFrame, unit.positionX * 16, unit.positionY * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// early exit, since we want the camera to finish its nice transition
|
// 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 newX = Math.floor(mousePos.x);
|
||||||
double newY = Math.floor(mousePos.y);
|
double newY = Math.floor(mousePos.y);
|
||||||
|
|
||||||
int newFixedX = (int) (newX / 32.0);
|
int newFixedX = (int) (newX / 16.0);
|
||||||
int newFixedY = (int) (newY / 32.0);
|
int newFixedY = (int) (newY / 16.0);
|
||||||
|
|
||||||
ArrayList<Vector2> path = AStar.path(new Vector2(currentUnit.positionX, currentUnit.positionY), new Vector2((float) newFixedX, (float) newFixedY), getCollision(), tiledMap);
|
ArrayList<Vector2> path = AStar.path(new Vector2(currentUnit.positionX, currentUnit.positionY), new Vector2((float) newFixedX, (float) newFixedY), getCollision(), tiledMap);
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
|
@ -336,7 +347,7 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spriteRegion != null) {
|
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 newX = Math.floor(mousePos.x);
|
||||||
double newY = Math.floor(mousePos.y);
|
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;
|
hasStartedMoving = false;
|
||||||
}
|
}
|
||||||
|
@ -397,7 +408,7 @@ public class GameScreen implements Screen {
|
||||||
currentUnit.positionX = (int) nextMove.x;
|
currentUnit.positionX = (int) nextMove.x;
|
||||||
currentUnit.positionY = (int) nextMove.y;
|
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 {
|
} else {
|
||||||
currentlyTakingAction = false;
|
currentlyTakingAction = false;
|
||||||
currentlyAwaitingAuxilaryAction = true;
|
currentlyAwaitingAuxilaryAction = true;
|
||||||
|
@ -434,8 +445,8 @@ public class GameScreen implements Screen {
|
||||||
double newX = Math.floor(mousePos.x);
|
double newX = Math.floor(mousePos.x);
|
||||||
double newY = Math.floor(mousePos.y);
|
double newY = Math.floor(mousePos.y);
|
||||||
|
|
||||||
int newFixedX = (int) (newX / 32.0);
|
int newFixedX = (int) (newX / 16.0);
|
||||||
int newFixedY = (int) (newY / 32.0);
|
int newFixedY = (int) (newY / 16.0);
|
||||||
|
|
||||||
List<UnitAction> actions = getAvailableActionsForPosition(newFixedX, newFixedY);
|
List<UnitAction> actions = getAvailableActionsForPosition(newFixedX, newFixedY);
|
||||||
for (int i = 0; i < actions.size(); i++) {
|
for (int i = 0; i < actions.size(); i++) {
|
||||||
|
@ -454,7 +465,8 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resize(int width, int height) {
|
public void resize(int width, int height) {
|
||||||
camera.setToOrtho(false, width, height);
|
camera.viewportWidth = 230;
|
||||||
|
camera.viewportHeight = 230 * ((float)height / (float)width);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Reference in a new issue