diff --git a/app/src/main/java/com/example/game2d/ChalkGameClass.java b/app/src/main/java/com/example/game2d/ChalkGameClass.java index 87e23329e557424b7012ce4a528e50738ccf4e69..065fa14a21cde91d3091d0bfc4d8611809ad3aee 100644 --- a/app/src/main/java/com/example/game2d/ChalkGameClass.java +++ b/app/src/main/java/com/example/game2d/ChalkGameClass.java @@ -29,7 +29,8 @@ public class ChalkGameClass extends View { private Bitmap backgroundImage ; //MEDIA - // MediaPlayer bonk, oof; + MediaPlayer bonk = MediaPlayer.create(getContext(), R.raw.bonk); + MediaPlayer oof = MediaPlayer.create(getContext(), R.raw.oof); //CHALK private Bitmap chalk[] = new Bitmap[5]; @@ -116,9 +117,6 @@ public class ChalkGameClass extends View { canvasWidth = canvas.getWidth(); canvasHeight = canvas.getHeight(); - // bonk = MediaPlayer.create(getContext(), R.raw.bonk); - //oof = MediaPlayer.create(getContext(), R.raw.oof); - if (backgroundImage == null) return; // Use the same Matrix over and over again to minimize // allocation in onDraw. @@ -147,7 +145,7 @@ public class ChalkGameClass extends View { if(normGravity) { playerSpeed = 125; - // bonk.start(); + bonk.start(); } } //limiting the player's y to the top of the screen @@ -179,7 +177,7 @@ public class ChalkGameClass extends View { if (hitChalkChecker(chalkX[ii], chalkY[ii])) //if player collides with chalk { chalkX[ii] = chalkX[ii] - 200; //makes chalk disappear - //oof.start(); + oof.start(); lifecounter--; //reduces health; if(lifecounter == 0) //if all lives used up