Loading app/src/main/java/com/example/game2d/ChalkGameClass.java +4 −6 Original line number Diff line number Diff line Loading @@ -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]; Loading Loading @@ -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. Loading Loading @@ -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 Loading Loading @@ -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 Loading Loading
app/src/main/java/com/example/game2d/ChalkGameClass.java +4 −6 Original line number Diff line number Diff line Loading @@ -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]; Loading Loading @@ -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. Loading Loading @@ -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 Loading Loading @@ -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 Loading