Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win menu #124

Merged
merged 2 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

<link rel="stylesheet" href="src/css/PauseMenu.css">
<link rel="stylesheet" href="src/css/MainMenu.css">
<link rel="stylesheet" href="src/css/WinMenu.css">

</head>

Expand All @@ -60,6 +61,7 @@
<script src="src/js/mainPlayer.js"></script>
<script src="src/js/videoCheck.js"></script>
<script src="src/js/menu.js"></script>
<script src="src/js/win.js"></script>
<script src="src/js/playing.js"></script>
<script src="src/js/Camera.js"></script>
<script src="src/js/pause.js"></script>
Expand Down
7 changes: 7 additions & 0 deletions sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ let fullHealth, twoHealth, oneHealth, deadHealth;
let mainMenu;
let pauseMenu;
let settingsMenu;
let winMenu;
let CreepyPiano1, CreepyPiano2;
let mainMenuSound;
let trapDoorImage;
Expand Down Expand Up @@ -158,6 +159,9 @@ function setup() {
//Makes a new settings menu
settingsMenu = new SettingsMenu();

//Makes a new win menu
winMenu = new WinMenu();

}

function draw() {
Expand Down Expand Up @@ -193,6 +197,9 @@ function draw() {
else if (GAMESTATE == "PAUSE") {
pauseFunctionality();
}
else if (GAMESTATE == "WON") {
winFunctionality();
}

/* TODO - FOR THE SETTINGS TRIGGER
/*else if (GAMESTATE == 'SETTINGS') {
Expand Down
80 changes: 80 additions & 0 deletions src/css/WinMenu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
CSS Styling for the pause screen

*/


/*
Lays out the grid implementation that will be overlaid to center the buttons
3x4 grid with fractional units for scalability
The 3 allows for a center
*/
.layoutGrid {
display: grid;
grid-template:
". . . . ." 1fr
". . . . ." 1fr
". . Exit . ." 1fr
". . . . ." 1fr
/1fr 1fr 1fr 1fr 1fr;
}

.Exit{
grid-area: Exit;
justify-content: center;
padding-top: 150px;

}

.EscapedMenuButtons{
background-color: transparent;
display: grid;
color: white;
border: none;
font-size: 25px;
font-family: 'Courier New', Courier, monospace;
}


.EscapedHeading {
color: white;
}

.EscapedMenuButtons:hover{
color: rgb(252, 252, 86);
}


@keyframes EscapedGlitch {
0% {
opacity: 1;
}
20% {
opacity: 0.8;
}
40% {
opacity: 0.9;
}
60% {
text-shadow: 0 0 10px yellow, 0 0 20px yellow, 0 0 30px yellow, 0 0 40px yellow, 0 0 50px yellow, 0 0 60px yellow, 0 0 70px yellow;
}
80% {
background-color: transparent;
color: rgb(255, 255, 157);
text-shadow: 0 0 10px rgb(255, 255, 117), 0 0 20px rgb(255, 255, 246), 0 0 30px rgb(255, 255, 0);
opacity: 0.75;
}
100% {
opacity: 1;
}
}

.EscapedH1 {
font-size: 7em;
color: rgb(255, 255, 0);
background-color: transparent;
border:none;
animation: EscapedGlitch 4s infinite;
text-shadow: 0 0 5px yellow; /* Add a yellow glow effect */
transition: all 0.1s ease-in-out; /* Smoother transition for the glitch effect */
}
62 changes: 62 additions & 0 deletions src/js/Screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,65 @@ class BlinkViewer {
return CURRENTGAMESTATE;
}
}

class WinMenu {
/**
* Default constructor, makes a background and exit buttons
*/
constructor() {
this.exitButton = createButton('> Exit');
this.title = createButton('YOU ESCAPED');

//Backdrop to the menu
this.menu = new Sprite(1920/2,1080/2,1920,1080);
this.menu.layer = MAIN_MENU_LAYER;
this.menu.opacity = 0.4;
this.menu.color = 'black';
this.menu.collider = 'none';

this.title.class("EscapedH1");
this.title.position(600,50);
this.title.hide();

// Setup exit Button
this.exitButton.class("EscapedMenuButtons");
this.exitButton.attribute("name", "exit");

this.exitButton.position(675,250)
this.exitButton.hide(); //Hides the button until win menu is triggered

}

/**
* Shows the menu and buttons
*
* @param {*} CURRENTGAMESTATE
*/
showMenu() {
this.menu.visible = true;
this.exitButton.show();
this.title.show();

}

/**
* Hides the menu
*
*/
hideMenu() {
this.exitButton.hide();
this.title.hide();
this.menu.visible = false;
}


/**
* Called when exit is clicked
* Takes you to the main menu
*/
exitGame(CURRENTGAMESTATE) {
this.hideMenu();
CURRENTGAMESTATE = "MENU";
return CURRENTGAMESTATE;
}
}
1 change: 1 addition & 0 deletions src/js/playing.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function playingFunctionality(){
}});
}
if(BOSSISALIVE) giantEyeBossfight();
else GAMESTATE = "WON";

}
if(player.health <= 0) {
Expand Down
13 changes: 13 additions & 0 deletions src/js/win.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function winFunctionality() {
player.velocity.y = 0;
player.velocity.x = 0;
player.changeAni("idle_" + playerMovement.lastDirection);
movementSounds(player,footsteps);

winMenu.showMenu();

winMenu.exitButton.mousePressed(() => {
GAMESTATE = winMenu.exitGame(GAMESTATE);

});
}
Loading