Skip to content

Commit

Permalink
Merge pull request #48 from COMP2522/JT_Menu2_and_carSelection_menu
Browse files Browse the repository at this point in the history
Jt menu2 and car selection menu
  • Loading branch information
erictatchell authored Mar 31, 2023
2 parents ebc55c0 + eae1538 commit a5410a7
Show file tree
Hide file tree
Showing 30 changed files with 132 additions and 96 deletions.
Binary file modified .gradle/7.5.1/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/7.5.1/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/checksums/sha1-checksums.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.5.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.5.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.5.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/file-system.probe
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions .idea/libraries/Gradle__org_mongodb_bson_record_codec_4_9_0.xml

This file was deleted.

4 changes: 2 additions & 2 deletions .idea/libraries/Gradle__org_opentest4j_opentest4j_1_2_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
60 changes: 7 additions & 53 deletions src/main/java/org/bcit/comp2522/dui/client/Button.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
package org.bcit.comp2522.dui.client;

/**
* The button class handles most user interactions in the game, including logic and UI.
*
* @author Eric Tatchell
*/
public class Button {

// window instance
private Window window;

// manager instance
private Manager manager;

/**
* Constructor building Window and Manager instances
* @param window parent
* @param manager parent
*/
public Button(Window window, Manager manager) {
this.window = window;
this.manager = manager;
}

// Restart button
public void restart() {
if (window.mouseX > ((window.width / 2) - 280) && window.mouseX < (window.width / 2) + 280
&& window.mouseY > 400 && window.mouseY < 475) {
Expand All @@ -33,30 +17,17 @@ public void restart() {
window.fill(0);
window.textFont(manager.contentLoader.smallFont);
window.text("PLAY AGAIN", (window.width / 2), 455);
if (window.mousePressed) { // when restart button is pressed

// sets screenState to 0 which is the Playing state
if (window.mousePressed) { // when play button is pressed
manager.screenState = 0;

// resets player lives to 3
manager.ui.player.lives = 3;

// Updates the players high score
manager.game.updateHighScore();

// Resets the in game score counter
manager.game.resetScore();

// Resumes the score counter after it was stopped upon TOTALED
manager.game.resumeScore();

// Re-initializes UI
manager.ui.init();
}
}
}

// Play button
public void play() {
if (window.mouseX > ((window.width / 2) - 150) && window.mouseX < ((window.width / 2)) + 150
&& window.mouseY > 450 && window.mouseY < 575) {
Expand All @@ -67,14 +38,14 @@ public void play() {
window.textFont(manager.contentLoader.mediumFont);
window.text("PLAY", window.width / 2, 535);
if (window.mousePressed) { // when play button is pressed

// 3 is Main Menu screen state
// window.playing = true;
manager.screenState = 3;
// ui.draw();

}
}
}

// Difficulty screen button
public void diff() {
if (window.mouseX > ((window.width / 2) - 150) &&
window.mouseX < ((window.width / 2)) + 150
Expand All @@ -87,14 +58,12 @@ public void diff() {
window.text("Difficulty", window.width / 2, 200);

if (window.mousePressed) {

// 6 is difficulty screenState
manager.screenState = 6;
manager.ui.draw();
}
}
}

// Car selection button
public void cars() {
if (window.mouseX > ((window.width / 2) - 150) &&
window.mouseX < ((window.width / 2)) + 150
Expand All @@ -107,14 +76,12 @@ public void cars() {
window.text("Cars", window.width / 2, 300);

if (window.mousePressed) {

// 4 is Car Selection screen state
manager.screenState = 4;
manager.ui.draw();
}
}
}

// Leaderboard button
public void leaderboard() {
if (window.mouseX > ((window.width / 2) - 150) &&
window.mouseX < ((window.width / 2)) + 150
Expand All @@ -127,15 +94,13 @@ public void leaderboard() {
window.text("Leaderboard", window.width / 2, 400);

if (window.mousePressed) {

// 5 is leaderboard screenState
manager.screenState = 5;
manager.ui.draw();
}
}
}


// Quit button
public void quit() {
if (window.mouseX > ((900) - 150) && window.mouseX < ((900)) + 150
&& window.mouseY > 450 && window.mouseY < 575) {
Expand All @@ -152,7 +117,6 @@ public void quit() {
}
}

// Red car select
public void red() {
//red
if (window.mouseX > ((50)) && window.mouseX < ((150)) + 100
Expand All @@ -167,8 +131,6 @@ public void red() {
window.text("Select", 150, 525);

if (window.mousePressed) {

// unimplemented
manager.screenState = 0;
}
}
Expand All @@ -189,7 +151,6 @@ public void yellow() {
window.text("Select", 475, 525);

if (window.mousePressed) {
// unimplemented
manager.screenState = 0;
}
}
Expand All @@ -210,7 +171,6 @@ public void blue() {
window.text("Select", 775, 525);

if (window.mousePressed) {
// unimplemented
manager.screenState = 0;
}
}
Expand All @@ -231,20 +191,14 @@ public void purple() {
window.text("Select", 1075, 525);

if (window.mousePressed) {
// unimplemented
manager.screenState = 0;
}
}
}

// Mute button
public void mute() {
if (window.mouseX > 300 && window.mouseX < 350
&& window.mouseY > 25 && window.mouseY < 75) {
if (window.mousePressed) {

// mutes the in game music

window.musicPlayer.stop();
manager.muted = true;
manager.ui.elements.muted();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/bcit/comp2522/dui/client/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ public class Manager extends PApplet {
*/
public int screenState;

public int carType;

public Manager() {
contentLoader = new ContentLoader();
}
public void run(Window scene) {
screenState = 2; // main menu
carType = 2;

path = new Path(this, scene); // Move this line before the UI initialization
ui = new UI(this, contentLoader, scene);
Expand Down
21 changes: 6 additions & 15 deletions src/main/java/org/bcit/comp2522/dui/client/Menu.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ public Menu(Manager manager, Window scene) {
this.window = scene;
}

// public void gameOver() {
// manager.game.updateHighScore();
// manager.game.resetScore();
// window.background(0);
// window.fill(255, 0, 0);
// window.textFont(manager.contentLoader.mediumFont);
// window.textAlign(window.CENTER);
// window.text("TOTALED", (window.width / 2), 200);
// window.rect((window.width / 2) - 280, 400, 560, 75);
// window.textAlign(window.CENTER);
// window.fill(0);
// window.textFont(manager.contentLoader.smallFont);
// window.text("PLAY AGAIN", (window.width / 2), 455);
// manager.button.restart();
// }
public void menu2() {
window.background(0);

Expand Down Expand Up @@ -261,6 +246,12 @@ public void Leaderboard() {
window.line(80, y - 20, window.width - 80, y - 20);
}

public void workInProgess() {
window.background(0);
window.textFont(manager.contentLoader.tinyFont);
window.text("Work in progress", window.width / 2, window.height / 2);
}

public void gameOver() {
window.background(0);
manager.keyInput.pressedKeys.clear();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/bcit/comp2522/dui/client/Player.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.bcit.comp2522.dui.client;

import org.bcit.comp2522.dui.ui.ContentLoader;
import org.bcit.comp2522.dui.ui.UI;
import processing.core.PImage;
import processing.core.PVector;
Expand Down Expand Up @@ -83,5 +84,6 @@ public float getPlayerSpeed() {

public void update(UI ui) {
manager.keyInput.updateKeyStates(ui);
ContentLoader contentLoader = manager.contentLoader;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a5410a7

Please sign in to comment.