Loading app/src/main/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -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" Loading app/src/main/java/com/example/game2d/object/ArtActivity.java→app/src/main/java/com/example/game2d/ArtActivity.java +0 −0 File moved. View file app/src/main/java/com/example/game2d/FirebaseActivity.java +2 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } }); Loading app/src/main/java/com/example/game2d/Game.java +16 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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) { Loading Loading @@ -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) { Loading @@ -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 Loading @@ -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); } } app/src/main/java/com/example/game2d/LeaderboardActivity.java +8 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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 Loading
app/src/main/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -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" Loading
app/src/main/java/com/example/game2d/object/ArtActivity.java→app/src/main/java/com/example/game2d/ArtActivity.java +0 −0 File moved. View file
app/src/main/java/com/example/game2d/FirebaseActivity.java +2 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); } }); Loading
app/src/main/java/com/example/game2d/Game.java +16 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading Loading @@ -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) { Loading Loading @@ -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) { Loading @@ -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 Loading @@ -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); } }
app/src/main/java/com/example/game2d/LeaderboardActivity.java +8 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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