Loading app/src/main/java/com/example/game2d/ChalkGameClass.java +4 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,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 @@ -120,9 +121,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 @@ -151,7 +149,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 @@ -183,7 +181,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 @@ -32,7 +32,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 @@ -120,9 +121,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 @@ -151,7 +149,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 @@ -183,7 +181,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