Skip to content

Commit

Permalink
For new maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Lost-Fly committed May 28, 2024
1 parent eea8ff4 commit edd4270
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 12 deletions.
Binary file added assets/enot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/grave_music.mp3
Binary file not shown.
5 changes: 4 additions & 1 deletion core/src/com/aqwsxlostfly/packandgo/Heroes/Heroes.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ public Heroes(Body body, TextureMapObject textureMapObject) {

switch (heroText) {
case "doc2.png":
this.heroHandsUp = new Texture(Gdx.files.internal("tile_0457.png"));
this.heroHandsUp = new Texture(Gdx.files.internal("docHnds.png"));
break;
case "tile_0456.png":
this.heroHandsUp = new Texture(Gdx.files.internal("heroHandsUp.png"));
break;
case "dwarf.png":
this.heroHandsUp = new Texture(Gdx.files.internal("dwarfHands.png"));
break;
default:
this.heroHandsUp = new Texture(Gdx.files.internal("heroHandsUp.png"));
break;
Expand Down
64 changes: 53 additions & 11 deletions core/src/com/aqwsxlostfly/packandgo/Screens/PlayScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import static com.aqwsxlostfly.packandgo.Main.messageSender;
import static com.aqwsxlostfly.packandgo.Main.screenHeight;
import static com.aqwsxlostfly.packandgo.Main.screenWidth;
import static com.aqwsxlostfly.packandgo.Screens.HomeSc.BANK_MAP_SEND;
import static com.aqwsxlostfly.packandgo.Screens.HomeSc.GRAVEYARD_MAP_SEND;
import static com.aqwsxlostfly.packandgo.Screens.HomeSc.HOME_MAP_SEND;
import static com.aqwsxlostfly.packandgo.Tools.maptools.TileMapHelper.defaultPlayerPosition;
import static com.aqwsxlostfly.packandgo.Tools.maptools.TileMapHelper.world;
import static com.aqwsxlostfly.packandgo.constants.ScreensConstants.HOW_TO_PLAY_INFO;
Expand Down Expand Up @@ -50,8 +53,10 @@ public class PlayScreen implements Screen {
public static final String PLAYER_STATE = "playerState";
public static final String PLAYER_STATE_DELETE = "playerStateDelete";
public static final String FURNITURE_STATE = "furnitureState";
private static final float TOTAL_GAME_TIME_LVL_1 = 6f * 60f;
private static final String PLAY_SCREEN_MUSIC = "Clown.mp3";
private static float TOTAL_GAME_TIME_LVL = 6f * 60f;
private static final String PLAY_SCREEN_MUSIC_HOME = "Clown.mp3";
private static final String PLAY_SCREEN_MUSIC_GRAVE = "grave_music.mp3";
private static final String PLAY_SCREEN_MUSIC_BANK = "bank_music.mp3";
private static final float STEP_TIME = 1 / 60f;
private static final float frameRateRender = 1 / 60f;
private static final float frameRateTimer = 1 / 50f;
Expand Down Expand Up @@ -87,7 +92,7 @@ public PlayScreen() {
isGameCountdownRunning = false;
isGameStarted = false;
countdownTimer = 3f;
gameTimer = TOTAL_GAME_TIME_LVL_1;
gameTimer = TOTAL_GAME_TIME_LVL;
font = new BitmapFont();
shapeRenderer = new ShapeRenderer();

Expand All @@ -97,8 +102,21 @@ public PlayScreen() {
hudCamera.position.set((float) screenWidth / 2, (float) screenHeight / 2, 0);
hudCamera.update();

musicTools = new MusicTools(PLAY_SCREEN_MUSIC);
musicTools.startMusic();
switch (gameSession.getSessionMap()){
case HOME_MAP_SEND:
musicTools = new MusicTools(PLAY_SCREEN_MUSIC_HOME);
musicTools.startMusic();
break;
case GRAVEYARD_MAP_SEND:
musicTools = new MusicTools(PLAY_SCREEN_MUSIC_GRAVE);
musicTools.startMusic();
break;
case BANK_MAP_SEND:
musicTools = new MusicTools(PLAY_SCREEN_MUSIC_BANK);
musicTools.startMusic();
break;
}


screamSound = Gdx.audio.newSound(Gdx.files.internal("scream.mp3"));

Expand Down Expand Up @@ -462,9 +480,9 @@ public void updateGameTimers(float delta) {
gameTimer -= delta;
if (gameTimer <= 0) {

endGame(getCurrentFurnitureCount(), TOTAL_GAME_TIME_LVL_1);
endGame(getCurrentFurnitureCount(), TOTAL_GAME_TIME_LVL);
} else if (Integer.valueOf(getCurrentFurnitureCount()).equals(Integer.valueOf(getMaxFurnitureCount()))) {
float takenTime = TOTAL_GAME_TIME_LVL_1 - gameTimer;
float takenTime = TOTAL_GAME_TIME_LVL - gameTimer;
endGame(getCurrentFurnitureCount(), takenTime);
}
}
Expand Down Expand Up @@ -496,7 +514,7 @@ private void endGame(String playersScore, float timeLeft) {
clearPlayers();
musicTools.stopMusic();

Renderer.setGameOverScreen(new GameOverScreen(playersScore, timeLeft, TOTAL_GAME_TIME_LVL_1, getMaxFurnitureCount()));
Renderer.setGameOverScreen(new GameOverScreen(playersScore, timeLeft, TOTAL_GAME_TIME_LVL, getMaxFurnitureCount()));
Renderer.setCurrentScreen(gameOverScreen);

}
Expand Down Expand Up @@ -635,8 +653,20 @@ public void restart() {

Gdx.input.setInputProcessor(inputMultiplexer);

musicTools = new MusicTools(PLAY_SCREEN_MUSIC);
musicTools.startMusic();
switch (gameSession.getSessionMap()){
case HOME_MAP_SEND:
musicTools = new MusicTools(PLAY_SCREEN_MUSIC_HOME);
musicTools.startMusic();
break;
case GRAVEYARD_MAP_SEND:
musicTools = new MusicTools(PLAY_SCREEN_MUSIC_GRAVE);
musicTools.startMusic();
break;
case BANK_MAP_SEND:
musicTools = new MusicTools(PLAY_SCREEN_MUSIC_BANK);
musicTools.startMusic();
break;
}

resetMap();

Expand All @@ -655,7 +685,7 @@ public void restart() {
isGameCountdownRunning = false;
isGameStarted = false;
countdownTimer = 3f;
gameTimer = TOTAL_GAME_TIME_LVL_1;
gameTimer = TOTAL_GAME_TIME_LVL;

timer.start();
startSendingState();
Expand All @@ -664,6 +694,18 @@ public void restart() {

public void resetMap() {

switch (gameSession.getSessionMap()){
case HOME_MAP_SEND:
TOTAL_GAME_TIME_LVL = 6F * 60F;
break;
case GRAVEYARD_MAP_SEND:
TOTAL_GAME_TIME_LVL = 8F * 60F;
break;
case BANK_MAP_SEND:
TOTAL_GAME_TIME_LVL = 10F*60F;
break;
}

furnitures.clear();

orthogonalTiledMapRenderer = tileMapHelper.setupMap(gameSession.getSessionMap());
Expand Down
Binary file added server/out/artifacts/packandgo_jar/packandgo.jar
Binary file not shown.

0 comments on commit edd4270

Please sign in to comment.