Merge branch 'master' of https://github.com/teamteamteam/SpaceScooter
This commit is contained in:
commit
148c9ca491
|
@ -1,5 +1,5 @@
|
||||||
name:Lustiger Levelname
|
name:Testlevel \o/
|
||||||
backgroundMusic:music/bla.wav
|
backgroundMusic:music/ScooterFriendsTurbo8Bit.wav
|
||||||
background:StarBackground
|
background:StarBackground
|
||||||
-
|
-
|
||||||
[0-4]
|
[0-4]
|
||||||
|
|
|
@ -9,6 +9,7 @@ import de.teamteamteam.spacescooter.entity.enemy.EnemyOne;
|
||||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
||||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyTwo;
|
import de.teamteamteam.spacescooter.entity.enemy.EnemyTwo;
|
||||||
import de.teamteamteam.spacescooter.screen.GameScreen;
|
import de.teamteamteam.spacescooter.screen.GameScreen;
|
||||||
|
import de.teamteamteam.spacescooter.sound.SoundSystem;
|
||||||
import de.teamteamteam.spacescooter.utility.Loader;
|
import de.teamteamteam.spacescooter.utility.Loader;
|
||||||
import de.teamteamteam.spacescooter.utility.Random;
|
import de.teamteamteam.spacescooter.utility.Random;
|
||||||
|
|
||||||
|
@ -32,6 +33,11 @@ public final class Level {
|
||||||
*/
|
*/
|
||||||
private int levelClock;
|
private int levelClock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thread handle for the backgroundMusic being played.
|
||||||
|
*/
|
||||||
|
private Thread backgroundMusic;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor creating a LevelConfig based on a given config file.
|
* Constructor creating a LevelConfig based on a given config file.
|
||||||
|
@ -48,6 +54,7 @@ public final class Level {
|
||||||
public void doBuildUp() {
|
public void doBuildUp() {
|
||||||
this.spawnEntityByAvailableName(Entity.availableNames.valueOf(this.config.background), 0, 50);
|
this.spawnEntityByAvailableName(Entity.availableNames.valueOf(this.config.background), 0, 50);
|
||||||
GameScreen.setPlayer(new Player(200, 300));
|
GameScreen.setPlayer(new Player(200, 300));
|
||||||
|
this.backgroundMusic = SoundSystem.playSound(this.config.backgroundMusic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,4 +136,15 @@ public final class Level {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up before the Level is torn down.
|
||||||
|
* Stop the music, ...
|
||||||
|
*/
|
||||||
|
public void tearDown() {
|
||||||
|
if(this.backgroundMusic != null) {
|
||||||
|
this.backgroundMusic.interrupt();
|
||||||
|
this.backgroundMusic = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import de.teamteamteam.spacescooter.gui.InterfaceBar;
|
||||||
import de.teamteamteam.spacescooter.gui.ScoreBar;
|
import de.teamteamteam.spacescooter.gui.ScoreBar;
|
||||||
import de.teamteamteam.spacescooter.gui.ShieldBar;
|
import de.teamteamteam.spacescooter.gui.ShieldBar;
|
||||||
import de.teamteamteam.spacescooter.level.Level;
|
import de.teamteamteam.spacescooter.level.Level;
|
||||||
import de.teamteamteam.spacescooter.sound.SoundSystem;
|
|
||||||
import de.teamteamteam.spacescooter.utility.CollisionHandler;
|
import de.teamteamteam.spacescooter.utility.CollisionHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,11 +32,6 @@ public class GameScreen extends Screen {
|
||||||
*/
|
*/
|
||||||
private long gameClockTrigger;
|
private long gameClockTrigger;
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal Thread handle for the background music.
|
|
||||||
*/
|
|
||||||
private Thread backgroundMusic;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GameScreen Constructor.
|
* GameScreen Constructor.
|
||||||
* Takes the level as its second parameter.
|
* Takes the level as its second parameter.
|
||||||
|
@ -54,8 +48,6 @@ public class GameScreen extends Screen {
|
||||||
new HealthBar(10, 5);
|
new HealthBar(10, 5);
|
||||||
new ShieldBar(10, 27);
|
new ShieldBar(10, 27);
|
||||||
new ScoreBar(575, 33);
|
new ScoreBar(575, 33);
|
||||||
|
|
||||||
this.backgroundMusic = SoundSystem.playSound("music/ScooterFriendsTurbo8Bit.wav");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +98,7 @@ public class GameScreen extends Screen {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
this.backgroundMusic.interrupt();
|
this.level.tearDown();
|
||||||
super.cleanup();
|
super.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue