Loading app/src/main/java/com/example/game2d/ChalkActivity.java +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class ChalkActivity extends AppCompatActivity implements View.OnClickList spawnGame.putExtra("QuestionCount", currentQuestionIndex); Log.d("QUESTION", "Starting chalk game..."); getApplicationContext().startActivity(spawnGame); loadNewQuestion(); } } else { // one of the choices buttons clicked Loading app/src/main/java/com/example/game2d/ChalkGameClass.java +16 −3 Original line number Diff line number Diff line Loading @@ -37,9 +37,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 @@ -74,6 +74,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 @@ -360,4 +364,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/ChalkQuestionAnswer.java +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ public class ChalkQuestionAnswer { }; public static String[][] choices = { {"501B50797001", "501C50767001", "501C50757001", "501B50797001"}, {"501B50797001", "501C50767001", "501C50757001", "501B50897001"}, {"C0017001C0017001", "B0017001D0017001", "C0016001C0016001", "B0017001D0018001"}, {"5000504a50947040", "5000504b50957040", "5000504a50947040", "5000504b50947040"}, {"c000c0014042d7fc", "c000d0024042d7fc", "c000d0014042d7fb", "c000c0014042d7fc"}, Loading 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 app/src/main/java/com/example/game2d/FirebaseActivity.java +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; Loading Loading @@ -112,6 +113,7 @@ public class FirebaseActivity extends AppCompatActivity { public void onClick(View view) { UploadData(); RetrieveData(); Toast.makeText(FirebaseActivity.this, "Synched!", Toast.LENGTH_SHORT).show(); } }); Loading Loading
app/src/main/java/com/example/game2d/ChalkActivity.java +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class ChalkActivity extends AppCompatActivity implements View.OnClickList spawnGame.putExtra("QuestionCount", currentQuestionIndex); Log.d("QUESTION", "Starting chalk game..."); getApplicationContext().startActivity(spawnGame); loadNewQuestion(); } } else { // one of the choices buttons clicked Loading
app/src/main/java/com/example/game2d/ChalkGameClass.java +16 −3 Original line number Diff line number Diff line Loading @@ -37,9 +37,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 @@ -74,6 +74,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 @@ -360,4 +364,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/ChalkQuestionAnswer.java +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ public class ChalkQuestionAnswer { }; public static String[][] choices = { {"501B50797001", "501C50767001", "501C50757001", "501B50797001"}, {"501B50797001", "501C50767001", "501C50757001", "501B50897001"}, {"C0017001C0017001", "B0017001D0017001", "C0016001C0016001", "B0017001D0018001"}, {"5000504a50947040", "5000504b50957040", "5000504a50947040", "5000504b50947040"}, {"c000c0014042d7fc", "c000d0024042d7fc", "c000d0014042d7fb", "c000c0014042d7fc"}, Loading
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
app/src/main/java/com/example/game2d/FirebaseActivity.java +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; Loading Loading @@ -112,6 +113,7 @@ public class FirebaseActivity extends AppCompatActivity { public void onClick(View view) { UploadData(); RetrieveData(); Toast.makeText(FirebaseActivity.this, "Synched!", Toast.LENGTH_SHORT).show(); } }); Loading