Commit 67ec55f9 authored by Ethan Liang's avatar Ethan Liang
Browse files

metal click sound; resume and pause for chalk game music,

parent b4b5448a
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -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];
@@ -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);
@@ -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();
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -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;
@@ -25,6 +26,8 @@ public class CharacterActivity extends AppCompatActivity {

    public boolean selectedShortHair;

    MediaPlayer openSound;

    String username ; // <--- store the username in this variable

    String ID;
@@ -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,