Add a cursor sprite
This commit is contained in:
parent
3c7115f8b9
commit
08978c32ec
2 changed files with 8 additions and 0 deletions
BIN
assets/cursor.png
Normal file
BIN
assets/cursor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 149 B |
|
@ -52,6 +52,9 @@ public class GameScreen implements Screen {
|
||||||
|
|
||||||
boolean currentlyAwaitingAuxilaryAction = false;
|
boolean currentlyAwaitingAuxilaryAction = false;
|
||||||
|
|
||||||
|
int cursorX = 0, cursorY = 0;
|
||||||
|
Texture cursorTexture;
|
||||||
|
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
private Table table;
|
private Table table;
|
||||||
|
|
||||||
|
@ -104,6 +107,7 @@ public class GameScreen implements Screen {
|
||||||
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);
|
||||||
|
|
||||||
arrowSpritesheet = new ArrowSpritesheet();
|
arrowSpritesheet = new ArrowSpritesheet();
|
||||||
|
cursorTexture = new Texture("cursor.png");
|
||||||
|
|
||||||
stage = new Stage();
|
stage = new Stage();
|
||||||
Gdx.input.setInputProcessor(stage);
|
Gdx.input.setInputProcessor(stage);
|
||||||
|
@ -150,6 +154,8 @@ public class GameScreen implements Screen {
|
||||||
getNextUnit();
|
getNextUnit();
|
||||||
|
|
||||||
if(currentUnit != null) {
|
if(currentUnit != null) {
|
||||||
|
cursorX = currentUnit.positionX;
|
||||||
|
cursorY = currentUnit.positionY;
|
||||||
smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0));
|
smoothlyTransitionCamera(new Vector3(currentUnit.positionX * 16, currentUnit.positionY * 16, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,6 +672,8 @@ public class GameScreen implements Screen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
game.batch.draw(cursorTexture, cursorX * 16, cursorY * 16);
|
||||||
|
|
||||||
game.batch.end();
|
game.batch.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue