Added randomly changing gamemusic and changed menu music -> Version 0.5.0
This commit is contained in:
parent
be1ec63e32
commit
3239a54ee9
@ -9,8 +9,8 @@ android {
|
||||
applicationId 'de.frajul.endlessroll'
|
||||
minSdkVersion 12
|
||||
targetSdkVersion 23
|
||||
versionCode 4
|
||||
versionName '0.4.0'
|
||||
versionCode 5
|
||||
versionName '0.5.0'
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.frajul.endlessroll"
|
||||
android:versionCode="4"
|
||||
android:versionName="0.4.0" >
|
||||
android:versionCode="5"
|
||||
android:versionName="0.5.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="12"
|
||||
|
@ -867,20 +867,22 @@ int layout unlock_message 0x7f0a0041
|
||||
int layout world_button 0x7f0a0042
|
||||
int layout worlds 0x7f0a0043
|
||||
int mipmap ic_launcher 0x7f0b0000
|
||||
int raw music_game 0x7f0c0000
|
||||
int raw music_menu 0x7f0c0001
|
||||
int raw sound_collect_energy 0x7f0c0002
|
||||
int raw sound_collect_star 0x7f0c0003
|
||||
int raw sound_countdown 0x7f0c0004
|
||||
int raw sound_die 0x7f0c0005
|
||||
int raw sound_explosion 0x7f0c0006
|
||||
int raw sound_firework 0x7f0c0007
|
||||
int raw sound_goal 0x7f0c0008
|
||||
int raw sound_magnet 0x7f0c0009
|
||||
int raw sound_mushroom 0x7f0c000a
|
||||
int raw sound_place_tool 0x7f0c000b
|
||||
int raw sound_spring 0x7f0c000c
|
||||
int raw sound_stasis 0x7f0c000d
|
||||
int raw music_game_1 0x7f0c0000
|
||||
int raw music_game_2 0x7f0c0001
|
||||
int raw music_game_3 0x7f0c0002
|
||||
int raw music_menu 0x7f0c0003
|
||||
int raw sound_collect_energy 0x7f0c0004
|
||||
int raw sound_collect_star 0x7f0c0005
|
||||
int raw sound_countdown 0x7f0c0006
|
||||
int raw sound_die 0x7f0c0007
|
||||
int raw sound_explosion 0x7f0c0008
|
||||
int raw sound_firework 0x7f0c0009
|
||||
int raw sound_goal 0x7f0c000a
|
||||
int raw sound_magnet 0x7f0c000b
|
||||
int raw sound_mushroom 0x7f0c000c
|
||||
int raw sound_place_tool 0x7f0c000d
|
||||
int raw sound_spring 0x7f0c000e
|
||||
int raw sound_stasis 0x7f0c000f
|
||||
int string abc_action_bar_home_description 0x7f0d0000
|
||||
int string abc_action_bar_home_description_format 0x7f0d0001
|
||||
int string abc_action_bar_home_subtitle_description_format 0x7f0d0002
|
||||
|
@ -435,18 +435,5 @@
|
||||
</stars>
|
||||
<energy x="18.570074" y="0.46666658"/>
|
||||
</level>
|
||||
<level packId="2" id="7" goalX="3.0" startSpeed="0.5" endSpeed="0.5" terrainEdge="-0.6" ceilingEdge="1.0">
|
||||
<terrainTiles class="java.util.ArrayList">
|
||||
<tileData x="0.0" width="6.0"/>
|
||||
</terrainTiles>
|
||||
<ceilingTiles class="java.util.ArrayList">
|
||||
<tileData x="0.0" width="6.0"/>
|
||||
</ceilingTiles>
|
||||
<obstacles class="java.util.ArrayList"/>
|
||||
<stars class="java.util.ArrayList">
|
||||
<positionData x="0.3066666" y="-0.37999997"/>
|
||||
</stars>
|
||||
<energy x="1.9466664" y="-0.3933333"/>
|
||||
</level>
|
||||
</levels>
|
||||
</levelPack>
|
@ -88,7 +88,8 @@ public class Game extends Rendering<GameScene> {
|
||||
this.level = level;
|
||||
this.levelPack = levelPack;
|
||||
if (scene != null) {
|
||||
gameActivity.getSoundManager().gameMusic.reset();
|
||||
gameActivity.getSoundManager().getCurrentGameMusic().reset();
|
||||
gameActivity.getSoundManager().randomizeCurrentGameMusic();
|
||||
gameState = GameState.COUNTDOWN;
|
||||
gameActivity.getTutorialManager().resetGameTutorials();
|
||||
collectedStars.clear();
|
||||
@ -108,7 +109,7 @@ public class Game extends Rendering<GameScene> {
|
||||
|
||||
public void countdownFinished() {
|
||||
gameActivity.getSoundManager().resumeAllSounds();
|
||||
gameActivity.getSoundManager().gameMusic.start();
|
||||
gameActivity.getSoundManager().getCurrentGameMusic().start();
|
||||
gameState = GameState.RUNNING;
|
||||
}
|
||||
|
||||
@ -207,7 +208,7 @@ public class Game extends Rendering<GameScene> {
|
||||
if (gameState == GameState.GAME_OVER || gameState == GameState.LEVEL_FINISHED || gameState == GameState.PAUSED)
|
||||
return;
|
||||
gameActivity.getSoundManager().pauseAllSounds();
|
||||
gameActivity.getSoundManager().gameMusic.pause();
|
||||
gameActivity.getSoundManager().getCurrentGameMusic().pause();
|
||||
viewManager.showShortMenu();
|
||||
if (gameState == GameState.COUNTDOWN)
|
||||
viewManager.stopCountdown();
|
||||
@ -232,7 +233,7 @@ public class Game extends Rendering<GameScene> {
|
||||
}
|
||||
|
||||
public void onGameOver(boolean playerExplode) {
|
||||
gameActivity.getSoundManager().gameMusic.stop();
|
||||
gameActivity.getSoundManager().getCurrentGameMusic().stop();
|
||||
gameActivity.getSoundManager().stopAllSounds();
|
||||
gameActivity.getSoundManager().playSound(gameActivity.getSoundManager().dieSound);
|
||||
if (playerExplode) {
|
||||
@ -245,7 +246,7 @@ public class Game extends Rendering<GameScene> {
|
||||
}
|
||||
|
||||
private void onGoalReached() {
|
||||
gameActivity.getSoundManager().gameMusic.stop();
|
||||
gameActivity.getSoundManager().getCurrentGameMusic().stop();
|
||||
gameActivity.getSoundManager().stopAllSounds();
|
||||
gameActivity.getSoundManager().playSound(gameActivity.getSoundManager().goalSound);
|
||||
|
||||
|
@ -3,9 +3,11 @@ package de.frajul.endlessroll.sounds;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.media.SoundPool;
|
||||
import android.support.annotation.RawRes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import de.frajul.endlessroll.R;
|
||||
import de.frajul.endlessroll.main.GameActivity;
|
||||
@ -17,12 +19,14 @@ import de.frajul.endlessroll.main.GameLog;
|
||||
public class SoundManager {
|
||||
|
||||
private Context context;
|
||||
private Random random;
|
||||
private SoundPool soundPool;
|
||||
private boolean soundsMuted;
|
||||
private boolean musicMuted;
|
||||
|
||||
public final Music menuMusic;
|
||||
public final Music gameMusic;
|
||||
private List<Music> gameMusicList = new ArrayList<>();
|
||||
private int currentGameMusicIndex = 0;
|
||||
|
||||
public final Sound goalSound;
|
||||
public final Sound dieSound;
|
||||
@ -39,14 +43,16 @@ public class SoundManager {
|
||||
|
||||
private List<SoundStream> allStartedStreams = new ArrayList<>();
|
||||
|
||||
public SoundManager(GameActivity activity) {
|
||||
this.context = activity;
|
||||
public SoundManager(GameActivity gameActivity) {
|
||||
this.context = gameActivity;
|
||||
random = new Random();
|
||||
soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
|
||||
|
||||
menuMusic = new Music(activity, activity, R.raw.music_menu);
|
||||
menuMusic = new Music(gameActivity, gameActivity, R.raw.music_menu);
|
||||
menuMusic.getPlayer().setLooping(true);
|
||||
gameMusic = new Music(activity, context, R.raw.music_game);
|
||||
gameMusic.getPlayer().setLooping(true);
|
||||
gameMusicList.add(createGameMusic(gameActivity, R.raw.music_game_1));
|
||||
gameMusicList.add(createGameMusic(gameActivity, R.raw.music_game_2));
|
||||
gameMusicList.add(createGameMusic(gameActivity, R.raw.music_game_3));
|
||||
|
||||
goalSound = new Sound(loadSound(R.raw.sound_goal));
|
||||
dieSound = new Sound(loadSound(R.raw.sound_die));
|
||||
@ -62,6 +68,22 @@ public class SoundManager {
|
||||
magnetSound = new Sound(loadSound(R.raw.sound_magnet), 0.8f, true);
|
||||
}
|
||||
|
||||
private Music createGameMusic(GameActivity gameActivity, @RawRes int musicId) {
|
||||
Music gameMusic = new Music(gameActivity, context, musicId);
|
||||
gameMusic.getPlayer().setLooping(true);
|
||||
return gameMusic;
|
||||
}
|
||||
|
||||
public void randomizeCurrentGameMusic() {
|
||||
getCurrentGameMusic().stop();
|
||||
int randomIndex = random.nextInt(gameMusicList.size());
|
||||
currentGameMusicIndex = randomIndex;
|
||||
}
|
||||
|
||||
public Music getCurrentGameMusic() {
|
||||
return gameMusicList.get(currentGameMusicIndex);
|
||||
}
|
||||
|
||||
public void setSoundsMuted(boolean soundsMuted) {
|
||||
this.soundsMuted = soundsMuted;
|
||||
for (SoundStream stream : allStartedStreams) {
|
||||
@ -74,7 +96,8 @@ public class SoundManager {
|
||||
public void setMusicMuted(boolean musicMuted) {
|
||||
this.musicMuted = musicMuted;
|
||||
menuMusic.setMuted(musicMuted);
|
||||
gameMusic.setMuted(musicMuted);
|
||||
for (Music gameMusic : gameMusicList)
|
||||
gameMusic.setMuted(musicMuted);
|
||||
}
|
||||
|
||||
public boolean isSoundsMuted() {
|
||||
@ -87,13 +110,15 @@ public class SoundManager {
|
||||
|
||||
public void activityPause() {
|
||||
soundPool.autoPause();
|
||||
gameMusic.activityPause();
|
||||
for (Music gameMusic : gameMusicList)
|
||||
gameMusic.activityPause();
|
||||
menuMusic.activityPause();
|
||||
}
|
||||
|
||||
public void activityResume() {
|
||||
soundPool.autoResume();
|
||||
gameMusic.activityResume();
|
||||
for (Music gameMusic : gameMusicList)
|
||||
gameMusic.activityResume();
|
||||
menuMusic.activityResume();
|
||||
}
|
||||
|
||||
@ -109,7 +134,8 @@ public class SoundManager {
|
||||
|
||||
public void destroy() {
|
||||
menuMusic.getPlayer().release();
|
||||
gameMusic.getPlayer().release();
|
||||
for (Music gameMusic : gameMusicList)
|
||||
gameMusic.getPlayer().release();
|
||||
soundPool.release();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/start_screen_unlock_all_levels"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/startscreen_gain_90_ep"
|
||||
@ -39,7 +39,7 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:text="@string/start_screen_gain_90_ep"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/startscreen_finish_world_1"
|
||||
@ -63,6 +63,6 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="10dp"
|
||||
android:text="@string/start_screen_to_gl_test_screen"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
BIN
app/src/main/res/raw/music_game_2.mp3
Normal file
BIN
app/src/main/res/raw/music_game_2.mp3
Normal file
Binary file not shown.
BIN
app/src/main/res/raw/music_game_3.mp3
Normal file
BIN
app/src/main/res/raw/music_game_3.mp3
Normal file
Binary file not shown.
BIN
app/src/main/res/raw/music_menu.mp3
Normal file
BIN
app/src/main/res/raw/music_menu.mp3
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user