Loading app/src/main/java/com/example/game2d/ChalkGameClass.java +16 −3 Original line number Diff line number Diff line Loading @@ -35,9 +35,9 @@ public class ChalkGameClass extends View { private Bitmap backgroundImage ; //MEDIA MediaPlayer bonk = MediaPlayer.create(getContext(), R.raw.bonk); MediaPlayer oof = MediaPlayer.create(getContext(), R.raw.oof); MediaPlayer bossMusic = MediaPlayer.create(getContext(), R.raw.aramid); MediaPlayer bonk; MediaPlayer oof; MediaPlayer bossMusic; //CHALK private Bitmap chalk[] = new Bitmap[5]; Loading Loading @@ -72,6 +72,10 @@ public class ChalkGameClass extends View { { super(context); bonk = MediaPlayer.create(getContext(), R.raw.bonk); oof = MediaPlayer.create(getContext(), R.raw.oof); bossMusic = MediaPlayer.create(getContext(), R.raw.aramid); SharedPreferences preferences = getContext().getSharedPreferences("MY_PREFS", 0); selectedShortHair = preferences.getBoolean("shortHairSelection", false); chalkIndex = preferences.getInt("ChalkQuestionIndex", 0); Loading Loading @@ -349,4 +353,13 @@ public class ChalkGameClass extends View { return false; } @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); if (hasWindowFocus) { //onresume() called bossMusic.start(); } else { // onPause() called bossMusic.pause(); } } } app/src/main/java/com/example/game2d/CharacterActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.View; Loading @@ -25,6 +26,8 @@ public class CharacterActivity extends AppCompatActivity { public boolean selectedShortHair; MediaPlayer openSound; String username ; // <--- store the username in this variable String ID; Loading @@ -34,6 +37,8 @@ public class CharacterActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_character_selection); openSound = MediaPlayer.create(this, R.raw.metal_click); Window window = getWindow(); window.setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, Loading Loading
app/src/main/java/com/example/game2d/ChalkGameClass.java +16 −3 Original line number Diff line number Diff line Loading @@ -35,9 +35,9 @@ public class ChalkGameClass extends View { private Bitmap backgroundImage ; //MEDIA MediaPlayer bonk = MediaPlayer.create(getContext(), R.raw.bonk); MediaPlayer oof = MediaPlayer.create(getContext(), R.raw.oof); MediaPlayer bossMusic = MediaPlayer.create(getContext(), R.raw.aramid); MediaPlayer bonk; MediaPlayer oof; MediaPlayer bossMusic; //CHALK private Bitmap chalk[] = new Bitmap[5]; Loading Loading @@ -72,6 +72,10 @@ public class ChalkGameClass extends View { { super(context); bonk = MediaPlayer.create(getContext(), R.raw.bonk); oof = MediaPlayer.create(getContext(), R.raw.oof); bossMusic = MediaPlayer.create(getContext(), R.raw.aramid); SharedPreferences preferences = getContext().getSharedPreferences("MY_PREFS", 0); selectedShortHair = preferences.getBoolean("shortHairSelection", false); chalkIndex = preferences.getInt("ChalkQuestionIndex", 0); Loading Loading @@ -349,4 +353,13 @@ public class ChalkGameClass extends View { return false; } @Override public void onWindowFocusChanged(boolean hasWindowFocus) { super.onWindowFocusChanged(hasWindowFocus); if (hasWindowFocus) { //onresume() called bossMusic.start(); } else { // onPause() called bossMusic.pause(); } } }
app/src/main/java/com/example/game2d/CharacterActivity.java +5 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.View; Loading @@ -25,6 +26,8 @@ public class CharacterActivity extends AppCompatActivity { public boolean selectedShortHair; MediaPlayer openSound; String username ; // <--- store the username in this variable String ID; Loading @@ -34,6 +37,8 @@ public class CharacterActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_character_selection); openSound = MediaPlayer.create(this, R.raw.metal_click); Window window = getWindow(); window.setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, Loading