Skip to content
Snippets Groups Projects
Commit 687f3c59 authored by Elias Fierke's avatar Elias Fierke
Browse files

[chore:] sound integration

parent a054072b
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,7 @@ import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.physics.box2d.ContactImpulse;
import com.fiewie.idlespaceshiptycoon.gameobjects.SpaceShip;
import com.fiewie.idlespaceshiptycoon.logic.SoundManager;
import com.fiewie.idlespaceshiptycoon.gameobjects.Enemy;
import com.fiewie.idlespaceshiptycoon.gameobjects.Background;
import com.fiewie.idlespaceshiptycoon.gameobjects.BackgroundManager;
......@@ -125,6 +126,7 @@ public class GameStage extends Stage {
ship.coins++;
coin.remove();
coins.removeValue(coin, true);
SoundManager.getInstance().playSound("sounds/coin.mp3");
}
}
for (Enemy enemy : enemies) {
......@@ -134,6 +136,7 @@ public class GameStage extends Stage {
isGameOver = ship.takeDamage(enemy.damage);
enemy.remove();
enemies.removeValue(enemy, true);
SoundManager.getInstance().playSound("sounds/enemy_dead.wav");
}
for (Bullet bullet : bullets) {
......@@ -143,6 +146,9 @@ public class GameStage extends Stage {
enemy.remove();
enemies.removeValue(enemy, true);
score += enemy.score;
SoundManager.getInstance().playSound("sounds/enemy_dead_2.wav");
} else {
//SoundManager.getInstance().playSound("sounds/enemy_dead_2.wav");
}
bullet.remove();
......@@ -156,6 +162,7 @@ public class GameStage extends Stage {
private void handleGameOver() {
if (isGameOver) {
System.out.println("Game Over!");
SoundManager.getInstance().playSound("sounds/game_over.wav");
showGameOverMenu();
}
}
......
......@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.fiewie.idlespaceshiptycoon.logic.SoundManager;
public class SpaceShip extends Actor {
private Texture texture;
......@@ -31,6 +32,7 @@ public class SpaceShip extends Actor {
}
public Bullet shoot() {
SoundManager.getInstance().playSound("sounds/shot.wav");
return new Bullet(getX(), getY() + getHeight());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment