diff --git a/core/assets/earrape.mp3 b/core/assets/earrape.mp3 new file mode 100644 index 0000000..8b017b3 Binary files /dev/null and b/core/assets/earrape.mp3 differ diff --git a/core/src/netwerkprog/game/client/MainGame.java b/core/src/netwerkprog/game/client/MainGame.java index b22b32f..6f3a338 100644 --- a/core/src/netwerkprog/game/client/MainGame.java +++ b/core/src/netwerkprog/game/client/MainGame.java @@ -76,13 +76,13 @@ public class MainGame extends ApplicationAdapter { String[] strings = new String[]{ "#########################", - "#xxxx #", - "# x #", - "# xxxx xxxxx #", - "# xxxx xxxxx #", - "# xxxx xx xx #", - "# x xxxxx #", - "# x xxxx #", + "#xxxx # #", + "# x # #", + "# xxxx #xxxx #", + "# xxxx #xxxx #", + "# xxxx #x xx #", + "# x #xxxx #", + "# x #xxx #", "# x #", "# xxxxxx #", "# x #", @@ -101,7 +101,7 @@ public class MainGame extends ApplicationAdapter { // this.tree.insert(new Hacker(,new BodySwap())); -// playSong(); + playSong(); // connectToServer(); @@ -124,7 +124,8 @@ public class MainGame extends ApplicationAdapter { for (int i = 1; i <= 5; i++) { GameCharacter temp = new Agent("Agent" + i, characters[11][0], new BodySwap("Test")); - mapRenderer.getGameTiles()[3][i].visit(temp); + int width = mapRenderer.getGameTiles()[0].length; + mapRenderer.getGameTiles()[3][width-(i+1)].visit(temp); if (chosenFaction == Faction.MEGACORPORATION) { this.team.addMember(temp); } @@ -136,7 +137,7 @@ public class MainGame extends ApplicationAdapter { private void playSong() { // play music - Music music = Gdx.audio.newMusic(Gdx.files.getFileHandle("core/assets/music.mp3", Files.FileType.Internal)); + Music music = Gdx.audio.newMusic(Gdx.files.getFileHandle("core/assets/earrape.mp3", Files.FileType.Internal)); music.setVolume(.1f); music.play(); music.setLooping(true); diff --git a/core/src/netwerkprog/game/client/game/map/GameInputProcessor.java b/core/src/netwerkprog/game/client/game/map/GameInputProcessor.java index 65c6ae6..498c15e 100644 --- a/core/src/netwerkprog/game/client/game/map/GameInputProcessor.java +++ b/core/src/netwerkprog/game/client/game/map/GameInputProcessor.java @@ -46,6 +46,7 @@ public class GameInputProcessor implements InputProcessor { camera.zoom = MathUtils.clamp(camera.zoom, 1.5f, 1.8f); + } public boolean isWPressed() { @@ -124,8 +125,10 @@ public class GameInputProcessor implements InputProcessor { System.out.println("HACKER"); mainGame.setChosenFaction(Faction.HACKER); mainGame.initCharacters(); + camera.translate(-400,0); mainGame.setGamestate(GAMESTATE.PLAYING); } + } return false; } @@ -148,21 +151,28 @@ public class GameInputProcessor implements InputProcessor { GameTile gameTile = mainGame.mapRenderer.getGameTiles()[row][col]; if (gameTile.contains(touchPoint.x, touchPoint.y)) { if (button == Input.Buttons.LEFT) { -// System.out.println(gameTile + " row: " + row + ", col: " + col); + + // moving selected character if (mainGame.hasCharacterSelected() && !gameTile.containsCharacter()) { -// System.out.println(mainGame.getSelectedCharacter()); + if (gameTile.getSymbol() != '#' && mainGame.mapRenderer.getSurroundedTilesOfCurrentCharacter().contains(gameTile)) { removeCharacterFromTile(mainGame.getSelectedCharacter()); gameTile.visit(mainGame.getSelectedCharacter()); mainGame.mapRenderer.setSurroundedTilesOfCurrentCharacter(col, row); } } +// clicking on enemy + if (mainGame.hasCharacterSelected() && gameTile.containsCharacter() && gameTile.getCharacter().getFaction() != mainGame.getChosenFaction()) { + gameTile.getCharacter().damage(10); + } + // set selected character if (!mainGame.hasCharacterSelected() && gameTile.containsCharacter()) { if (gameTile.getCharacter().getFaction() == mainGame.getChosenFaction()) { mainGame.setSelectedCharacter(gameTile.getCharacter()); mainGame.mapRenderer.setSurroundedTilesOfCurrentCharacter(col, row); } } + // switch character if (gameTile.containsCharacter() && !mainGame.getSelectedCharacter().equals(gameTile.getCharacter()) && gameTile.getCharacter().getFaction() == mainGame.getChosenFaction()) { diff --git a/core/src/netwerkprog/game/client/game/map/MapRenderer.java b/core/src/netwerkprog/game/client/game/map/MapRenderer.java index 5b0cd29..d745a88 100644 --- a/core/src/netwerkprog/game/client/game/map/MapRenderer.java +++ b/core/src/netwerkprog/game/client/game/map/MapRenderer.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import netwerkprog.game.client.MainGame; +import netwerkprog.game.util.application.Timer; import netwerkprog.game.util.game.GameCharacter; import netwerkprog.game.util.graphics.Renderable; @@ -118,9 +119,9 @@ public class MapRenderer implements Renderable { if (cur.containsCharacter()) { batch.draw(cur.getCharacter().getTextureRegion(), cur.x, cur.y); + if (cur.getCharacter().equals(mainGame.getSelectedCharacter())) { batch.draw(square, cur.x, cur.y); - } } } diff --git a/core/src/netwerkprog/game/util/game/GameCharacter.java b/core/src/netwerkprog/game/util/game/GameCharacter.java index 4715e86..83689b7 100644 --- a/core/src/netwerkprog/game/util/game/GameCharacter.java +++ b/core/src/netwerkprog/game/util/game/GameCharacter.java @@ -59,6 +59,7 @@ public abstract class GameCharacter extends Actor implements Comparable