refactor method

This commit is contained in:
Sem van der Hoeven
2020-06-07 17:06:00 +02:00
parent 3e316ccc17
commit 37cefd6d88
4 changed files with 24 additions and 18 deletions

View File

@@ -162,7 +162,7 @@ public class MainGame extends Game implements ClientCallback {
private void playSong() {
// play music
Music music = Gdx.audio.newMusic(Gdx.files.getFileHandle("core/assets/beat.mp3", Files.FileType.Internal));
Music music = Gdx.audio.newMusic(Gdx.files.getFileHandle("core/assets/sound/beat.mp3", Files.FileType.Internal));
music.setVolume(.1f);
music.play();
music.setLooping(true);
@@ -205,7 +205,8 @@ public class MainGame extends Game implements ClientCallback {
renderTurnText();
} else if (this.gamestate == GAMESTATE.SELECTING_FACTION) {
clearRender(67, 168, 186, 1);
renderString("FACTION SELECT\nYou are: " + username + "\nPress 1 for mega corporation, press 2 for hackers", Gdx.graphics.getWidth() / 2f, Gdx.graphics.getHeight() / 2f);
String text = username == null ? "Connecting to server..." : "FACTION SELECT\nYou are: " + username + "\nPress 1 for mega corporation, press 2 for hackers";
renderString(text, Gdx.graphics.getWidth() / 2f, Gdx.graphics.getHeight() / 2f);
if (this.ready && this.enemyReady) {
if (this.chosenFaction == Faction.HACKER) {
chooseHacker();
@@ -410,7 +411,7 @@ public class MainGame extends Game implements ClientCallback {
if (!moveData.getUsername().equals(this.username)) {
GameTile tile = mapRenderer.getGameTile(moveData.getPos());
GameCharacter character = enemyTeam.get(moveData.getCharacterName());
gameInputProcessor.removeCharacterFromTile(character);
mapRenderer.removeCharacterFromTile(character);
tile.visit(character);
}
} else if (data instanceof DamageData) {