Commit 4b7caa70 authored by Pranav Shrihari's avatar Pranav Shrihari
Browse files

Most of the sound effects added

parent b1171e00
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ public class ChalkGameClass extends View {
    private Bitmap backgroundImage ;

    //MEDIA
    MediaPlayer bonk;
    MediaPlayer bonk, oof;

    //CHALK
    private Bitmap chalk[] = new Bitmap[5];
@@ -102,6 +102,7 @@ public class ChalkGameClass extends View {
        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
@@ -160,6 +161,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();
                lifecounter--; //reduces health;

                if(lifecounter == 0)  //if all lives used up
+0 −2
Original line number Diff line number Diff line
@@ -47,6 +47,4 @@ public class MainActivity extends AppCompatActivity {
        super.onPause();
        backgroundMusic.stop();
    }


}
 No newline at end of file
+18 −1
Original line number Diff line number Diff line
@@ -7,7 +7,9 @@ import android.app.AlertDialog;
import android.content.SharedPreferences;
import android.content.Intent;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -29,6 +31,8 @@ public class NameActivity extends AppCompatActivity implements View.OnClickListe
    TextView nameTextView;
    Button yes, no, exit;

    MediaPlayer correct, wrong, backgroundMusic;

    ImageButton pauseBtn;

    int score=0;
@@ -51,6 +55,10 @@ public class NameActivity extends AppCompatActivity implements View.OnClickListe
                WindowManager.LayoutParams.FLAG_FULLSCREEN
        );

        correct = MediaPlayer.create(this, R.raw.correct);
        wrong = MediaPlayer.create(this, R.raw.gasp);
        backgroundMusic = MediaPlayer.create(this, R.raw.kahoot_music);

        //for pop up intro
        layout = findViewById(R.id.nameActivity); // relative is the id of the layout of the page
        CreatepopUpwindow();
@@ -67,7 +75,8 @@ public class NameActivity extends AppCompatActivity implements View.OnClickListe
        QuestionAnswer QA = new QuestionAnswer(); // Create an instance of MyClass
        QA.run(this); // Call the run method on myObject, passing in the context object


        backgroundMusic.start();
        backgroundMusic.setLooping(true);

        yes.setOnClickListener(this);
        no.setOnClickListener(this);
@@ -127,10 +136,13 @@ public class NameActivity extends AppCompatActivity implements View.OnClickListe
        else
            choice = false;


        if(choice == QuestionAnswer.tfArray[currentQuestionIndex]) {
            score++;
            correct.start();
            clickedButton.setBackgroundColor(Color.GREEN);
        }else{
            wrong.start();
            clickedButton.setBackgroundColor(Color.RED);
        }

@@ -191,4 +203,9 @@ public class NameActivity extends AppCompatActivity implements View.OnClickListe
        loadNewQuestion();
    }

    protected void onPause() {
        super.onPause();
        backgroundMusic.stop();
    }

}
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@
# !!!!!!!!!!!!!!!!!!!!! WAIT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# don't delete other people's paths, just put a hashtag to comment it out and then uncomment or add yours ty :)
#sdk.dir=/home/elena/Android/Sdk
#sdk.dir=/Users/prnv15/Library/Android/sdk
sdk.dir=/Users/joharper/Library/Android/sdk
sdk.dir=/Users/prnv15/Library/Android/sdk
#sdk.dir=/Users/joharper/Library/Android/sdk

>>>>>>>=fa0b39785e340f2e4603d94bdc597d48bc674390
<<<<<<<=HEAD