Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Feature/game element additions (#42)
Browse files Browse the repository at this point in the history
* added outline of ingame asset key

* createBody method of key implemented

* refactor ListenerClass

* implemented collectKey() in Key

* implemented keySensor in ListenerClass

* implemented drawing KeyImage

* refactored drawing KeyImage

* updated dispose functionality in Key

* removed dispose() in Key

* implemented key sceleton

* refactored key sceleton

* spawning key

* spawning key

* spawning key

* spawning key

* completely refactored Key

* completely refactored Key

* completely refactored Key

* completely refactored Key

* completely refactored Key

* completely refactored Key

* completely refactored Key

* urgent bugfix

* completely refactored Key

* completely refactored Key

* completely refactored Key + HUD integration

* performance

* Traps spawning

* Traps damage implemented

* VictoryScreen sceleton

* VictoryScreen sceleton

* implemented walking with player using arrow keys

* implemented walking with player using arrow keys

* DefeatScreen sceleton

* 2nd exit in GameScreen

* refactor Key spawn

* refactor Trap spawn

* commit

* commit

* fixed bug by not disposing exit open sound

* fixed bug from playing around with code and not restoring it

* implemented VictoryScreen

* implemented VictoryScreen

* implemented VictoryScreen

* implemented DefeatScreen

* implemented DefeatScreen

* added music to screens

* refactor VictoryScreen + DefeatScreen

* refactor VictoryScreen + DefeatScreen

* refactor VictoryScreen + DefeatScreen

* added soundEffect when player getting damage

* added soundEffect when player getting damage

* added soundEffect when player getting damage

* added soundEffect when player gets life

* added soundEffect when player gets life

* added soundEffect when player gets life

* added soundEffect when player collects key

* added soundEffect when player collects key

* added soundEffect when player collects key

* added soundEffect when player collects key

* added soundEffect when player gets power up

* added soundEffect when player gets power up

* added soundEffect when player gets power up

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in menu

* choose Map in PauseScreen

* choose Map in Menu

* added restart

* added restart in menus

* added restart in menus

* added restart in menus

* added restart in menus

* removed height in level-2.properties

* added back height in level-2.properties

* Trap2

* Trap2

* Trap2

* added quickstart to menu

* refactore fileChooser

* refactore PauseScreen

* refactore PauseScreen

* refactore PauseScreen

* idk

* soundEffect with maxHealth picking up healthCollectible fixed

* refactor Trap2

* refactor Trap2

* refactor Trap2

* refactor Trap2

* refactor Trap2

* refactor Trap2

* implement Score

* show score in HUD

* implement score based on time

* implement score based on time

* refactore calculating time

* refactore calculating time

* fixed calculating time

* fixed calculating time

* refactor wall render

* refactor wall render

* refactor wall render

* choose random map in menu

* refactor time

* refactor time

* add mapEditor in menu

* added background for menu

* added background for menu

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* test new map file

* refactored mapfile 2

* player attack Enemy

* player attack Enemy sceleton

* player attack Enemy sceleton

* refactoring ListenerClass for player attack

* refactoring ListenerClass for player attack

* refactoring ListenerClass for player attack

* refactoring ListenerClass for player attack

* refactoring ListenerClass for player attack

* player attack feature shipped

* refactor screens

* refactor screens

* Optimized screen rendering, added window modes and improved save-feature

Several enhancements have been made to the screen rendering process, focusing specifically on the use of texture regions in Wall.java. Adjustments were made to MazeRunnerGame.java to introduce different window modes, involving the set-up of both windowed and fullscreen options. Additionally, modifications were made to enable the saving of the last played map. This enables direct loading of this map for a QuickStart option, improving the user experience.

* music

* refactor combat mechanic

* refactor combat mechanic

* java docs

* sword swing animation

* sword swing animation

* refactor combat

* added game name

* refactor combat

* refactor combat

* refactor combat

* refactor combat

---------

Co-authored-by: Leon Adomaitis <[email protected]>
Co-authored-by: Leon Adomaitis <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent 59a890a commit b5abd3f
Show file tree
Hide file tree
Showing 65 changed files with 1,364 additions and 351 deletions.
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added assets/Editor/Habanera.mp3
Binary file not shown.
Binary file added assets/Killers.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion assets/Powerup Assets/Powerup.tpproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ prettyPrint=false
legacyOutput=false

scaleFactors=[{suffix:"",factor:1,resampling:bicubic}]
inputFiles=[{path:powerup-shield.png,type:Input,regionName:null},{path:powerup-speed.png,type:Input,regionName:null},{path:heart_1.png,type:Input,regionName:null},{path:heart_2.png,type:Input,regionName:null},{path:heart_3.png,type:Input,regionName:null},{path:heart_4.png,type:Input,regionName:null}]
inputFiles=[{path:powerup-shield.png,type:Input,regionName:null},{path:powerup-speed.png,type:Input,regionName:null},{path:heart_1.png,type:Input,regionName:null},{path:heart_2.png,type:Input,regionName:null},{path:heart_3.png,type:Input,regionName:null},{path:heart_4.png,type:Input,regionName:null},{path:../key.png,type:Input,regionName:null},{path:../traps.png,type:Input,regionName:null},{path:C:\\Users\\janjc\\Downloads\\trap2.png,type:Input,regionName:null}]
keepInputFileExtensions=false


Expand Down
18 changes: 12 additions & 6 deletions assets/Powerup Assets/output/Collectables.atlas
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
Collectables.png
size:128,32
size:256,512
repeat:none
heart
index:3
bounds:20,2,16,16
bounds:182,89,16,16
heart
index:2
bounds:56,2,16,16
bounds:222,487,16,16
heart
index:4
bounds:74,2,16,16
bounds:20,2,16,16
heart
index:1
bounds:92,2,16,16
bounds:182,71,16,16
key
bounds:202,474,18,29
powerup-shield
bounds:38,2,16,16
bounds:202,456,16,16
powerup-speed
bounds:2,2,16,16
trap2
bounds:2,107,198,396
traps
bounds:2,20,178,85
Binary file modified assets/Powerup Assets/output/Collectables.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/Strength of the Titans.mp3
Binary file not shown.
Binary file added assets/Victory(chosic.com).mp3
Binary file not shown.
Binary file added assets/ani1.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/ani2.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/ani3.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/backgrd.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/backgrdP.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/coin-upaif-14631.mp3
Binary file not shown.
Empty file added assets/extra.properties
Empty file.
Binary file added assets/fantasy_ui_button_6-102219.mp3
Binary file not shown.
Binary file added assets/fireball-whoosh-1-179125.mp3
Binary file not shown.
Binary file added assets/gameKey.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/gradient.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/icon.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/key-get-39925.mp3
Binary file not shown.
Binary file added assets/key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions assets/level-2.properties
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
30,25=0
18,38=0
30,24=0
Height=40
18,32=3
24,26=0
24,25=0
Expand Down Expand Up @@ -205,7 +204,6 @@ Height=40
6,2=0
6,0=0
32,19=0
Width=40
32,11=0
16,8=0
16,7=0
Expand Down
Binary file added assets/ough-47202.mp3
Binary file not shown.
Binary file added assets/short-choir-6116.mp3
Binary file not shown.
Binary file added assets/slime-squish-14539.mp3
Binary file not shown.
Binary file added assets/sword-slash-and-swing-185432.mp3
Binary file not shown.
Binary file added assets/trap2.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/traps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 21 additions & 2 deletions core/src/de/tum/cit/ase/editor/screens/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,11 @@ public void create() {

try {
super.create();
var s = new GameScreen(this, false);
var s = new GameScreen(this);
this.setScreen(s);
this.backgroundMusic = Gdx.audio.newMusic(Gdx.files.internal("Editor/Habanera.mp3"));
backgroundMusic.setLooping(true);
backgroundMusic.play();
} catch (Exception ex) {
editorUi.showMessage("Error", ex.getMessage());
Gdx.app.error("Test map intern", "Error testing map", ex);
Expand All @@ -219,13 +222,29 @@ public void render() {

@Override
public void goToMenu() {
window.closeWindow();

}

@Override
public void goToPause() {
window.closeWindow();
}

@Override
public void goToVictoryScreen() {
window.closeWindow();
}

@Override
public void goToDefeatScreen() {
window.closeWindow();
}

@Override
public void dispose() {
this.backgroundMusic.stop();
super.dispose();
}
};

} catch (Exception e) {
Expand Down
6 changes: 5 additions & 1 deletion core/src/de/tum/cit/ase/maze/Input/DeathListener.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.tum.cit.ase.maze.Input;

import de.tum.cit.ase.maze.objects.dynamic.Enemy;
import de.tum.cit.ase.maze.screens.GameScreen;
import de.tum.cit.ase.maze.objects.dynamic.Character;
import de.tum.cit.ase.maze.objects.dynamic.Player;
Expand All @@ -12,8 +13,11 @@ public DeathListener(GameScreen game) {
}

public void onDeath(Character deadCharacter){
if (deadCharacter instanceof Player){
if (deadCharacter instanceof Player) {
this.game.handleEndOfGame(false);
}
if (deadCharacter instanceof Enemy) {

Check warning on line 19 in core/src/de/tum/cit/ase/maze/Input/DeathListener.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Statement with empty body

`if` statement has empty body

}
}
}
10 changes: 10 additions & 0 deletions core/src/de/tum/cit/ase/maze/Input/GameInputProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class GameInputProcessor extends InputAdapter {
private final MazeRunnerGame game;
private final Movable character;
private boolean isAttack = false;

public GameInputProcessor(MazeRunnerGame game, Movable character) {
this.game = game;
Expand All @@ -29,8 +30,13 @@ public boolean keyDown(int keycode) {
case Input.Keys.A -> character.startMoving(WalkDirection.LEFT);
case Input.Keys.S -> character.startMoving(WalkDirection.DOWN);
case Input.Keys.D -> character.startMoving(WalkDirection.RIGHT);
case Input.Keys.UP -> character.startMoving(WalkDirection.UP);
case Input.Keys.LEFT -> character.startMoving(WalkDirection.LEFT);
case Input.Keys.DOWN -> character.startMoving(WalkDirection.DOWN);
case Input.Keys.RIGHT -> character.startMoving(WalkDirection.RIGHT);
case Input.Keys.SHIFT_LEFT -> ((Player) character).setSprint(true);
case Input.Keys.ESCAPE -> game.goToPause();
case Input.Keys.ENTER -> ((Player) character).attack(1);
}
return true;
} else {
Expand All @@ -50,6 +56,10 @@ public boolean keyUp(int keycode) {
case Input.Keys.A -> character.stopMoving(WalkDirection.LEFT);
case Input.Keys.S -> character.stopMoving(WalkDirection.DOWN);
case Input.Keys.D -> character.stopMoving(WalkDirection.RIGHT);
case Input.Keys.UP -> character.stopMoving(WalkDirection.UP);
case Input.Keys.LEFT -> character.stopMoving(WalkDirection.LEFT);
case Input.Keys.DOWN -> character.stopMoving(WalkDirection.DOWN);
case Input.Keys.RIGHT -> character.stopMoving(WalkDirection.RIGHT);
case Input.Keys.SHIFT_LEFT -> ((Player) character).setSprint(false);
}
return true;
Expand Down
17 changes: 12 additions & 5 deletions core/src/de/tum/cit/ase/maze/Input/ListenerClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import de.tum.cit.ase.maze.objects.dynamic.Enemy;
import de.tum.cit.ase.maze.objects.dynamic.Player;
import de.tum.cit.ase.maze.objects.still.Exit;
import de.tum.cit.ase.maze.objects.still.Key;
import de.tum.cit.ase.maze.objects.still.collectable.Collectable;

/**
Expand Down Expand Up @@ -49,17 +50,20 @@ public void beginContact(Contact contact) {
}
// Player Collect Collectable
if (contact.getFixtureA().getUserData() instanceof Player player && contact.getFixtureB().getUserData() instanceof Collectable collectable) {
Gdx.app.debug("Collectable", "Player collected Collectable");
// Gdx.app.debug("Collectable", "Player collected Collectable");
collectable.collect(player);
}


} else {
Gdx.app.debug("Contact with class", contact.getFixtureA().getUserData().getClass().getName() + " : " + contact.getFixtureB().getUserData().getClass().getName());

// Player bumped into an Enemy
if (contact.getFixtureB().getUserData() instanceof Enemy enemy && contact.getFixtureA().getUserData() instanceof Player player) {


player.setInReach(true);
if(player.isAttacking()) {
enemy.damage(1);
}
enemy.setPlayer(player);
enemy.isFollowing = false;

Expand All @@ -68,12 +72,15 @@ public void beginContact(Contact contact) {

} // Enemy bumped into a Player
else if (contact.getFixtureA().getUserData() instanceof Enemy enemy && contact.getFixtureB().getUserData() instanceof Player player) {

player.setInReach(true);
if(player.isAttacking()) {
enemy.damage(1);
}

enemy.setPlayer(player);
enemy.isFollowing = false;

player.makeDamage(1);
enemy.damage(1);

}

Expand Down
Loading

0 comments on commit b5abd3f

Please sign in to comment.