Commit 4ecc6f19 authored by Ethan Liang's avatar Ethan Liang
Browse files

Merge remote-tracking branch 'origin/top-secret' into top-secret

parents cffa3ad0 5e936670
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@
        android:supportsRtl="true"
        android:theme="@style/Theme.Game2D"
        tools:targetApi="31">
        <activity
            android:name=".ArtActivity"
            android:exported="false"
            android:screenOrientation="landscape"/>
        <activity
            android:name=".ChalkGameRIPActivity"
            android:exported="false"
+2 −0
Original line number Diff line number Diff line
@@ -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;
@@ -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();
            }
        });

+16 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback {
    private final Detector detector1;
    private final Detector detector2;
    private final Detector detector3;
    private final Detector detector4;

    private GameLoop gameLoop;
    private Context gameContext;
@@ -71,6 +72,7 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback {
        detector1 = new Detector(getContext(), player, (float) (width * 0.25), (float) (height * 0.17), 100);
        detector2 = new Detector(getContext(), player, (float) (width * 0.47), (float) (height * 0.17), 100);
        detector3 = new Detector(getContext(), player, (float) (width * 0.75), (float) (height * 0.17), 100);
        detector4 = new Detector(getContext(), player, (float) (width * 0.1), (float) (height * 0.17), 100);

        // copy other developers lol
        setFocusable(true);
@@ -137,6 +139,7 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback {
        detector1.draw(canvas);
        detector2.draw(canvas);
        detector3.draw(canvas);
        detector4.draw(canvas);
    }
    // method to display how many updates per second (UPS)
    public void drawUPS(Canvas canvas) {
@@ -170,6 +173,8 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback {
        detector1.update();
        detector2.update();
        detector3.update();
        detector4.update();

        // Check for collision with detectors
        if (Circle.isColliding(player, detector1)) {
            if (canMove) {
@@ -192,6 +197,13 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback {
            }
            canMove = false;
        }
        if (Circle.isColliding(player, detector4)) {
            if (canMove) {
                // call method to start art activity
                startArtActivity();
            }
            canMove = false;
        }
    }

    // check screen width and height
@@ -216,4 +228,8 @@ public class Game extends SurfaceView implements SurfaceHolder.Callback {
        Intent intent = new Intent(gameContext, FirebaseActivity.class);
        gameContext.startActivity(intent);
    }
    public void startArtActivity() {
        Intent intent = new Intent(gameContext, ArtActivity.class);
        gameContext.startActivity(intent);
    }
}
+8 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import static com.example.game2d.MapUtil.sortByValue;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
@@ -91,6 +92,7 @@ public class LeaderboardActivity extends AppCompatActivity {
            rankView.setFontFeatureSettings("press_start_2p");
            rankView.setText(String.format("%d",ranking));


            TextView nameView = new TextView(this);
            nameView.setTextSize(20);
            nameView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
@@ -103,7 +105,12 @@ public class LeaderboardActivity extends AppCompatActivity {
            scoreView.setFontFeatureSettings("press_start_2p");
            scoreView.setText(String.format("%f",  scoreboardObj.scoreboard.get(username)));


            if(ranking <=3)
            {
                rankView.setTextColor(Color.RED);
                nameView.setTextColor(Color.RED);
                scoreView.setTextColor(Color.RED);
            }

            // Add the TextView to the LinearLayout
            scoreListLayout.addView(rankView);
Loading