-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Yareaj/dev
Created and enhanced the landing menu
- Loading branch information
Showing
9 changed files
with
53 additions
and
23 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"background-color" : "#4a3429", | ||
"border" : "none", | ||
"border-radius" : "5px", | ||
"font-family" : "Fredoka-Bold", | ||
"font-size" : "35px", | ||
"color" : "#ffdeb3", | ||
"padding" : "5px 10px" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
let head; | ||
let backgroundImage, customLevelButton, levelListButton; | ||
|
||
function preload() { | ||
head = loadImage('./assets/player/head.png'); | ||
loadFont('./assets/fonts/Fredoka-Medium.ttf'); | ||
// Load assets for render | ||
backgroundImage = loadImage('./assets/images/menuBg.png'); | ||
menuButtonStyles = loadJSON('./assets/json/menuButtonStyles.json'); | ||
// Load buttons' fonts | ||
loadFont('./assets/fonts/Fredoka-Bold.ttf'); | ||
} | ||
|
||
function setup() { | ||
createCanvas(500, 500); | ||
customLevelButton = createButton('Custom Level'); | ||
levelListButton = createButton('Play'); | ||
} | ||
|
||
function draw() { | ||
background('#6f6f'); | ||
image(head, 0, 0); | ||
image(backgroundImage, 0, 0); | ||
|
||
textFont('Fredoka-Medium'); | ||
textSize(40); | ||
fill('#000'); | ||
const w = textWidth('Sokoban Worlds'); | ||
text(w, 100, 300); | ||
text('Sokoban Worlds', 80, 100); | ||
// Apply styles to the menu buttons | ||
applyStyles(levelListButton, menuButtonStyles); | ||
applyStyles(customLevelButton, menuButtonStyles); | ||
|
||
// Position the buttons on the screen | ||
levelListButton.position(width/2.4, height/1.93); | ||
customLevelButton.position(width/3.6, height/1.5); | ||
|
||
// Add listeners for button actions | ||
levelListButton.mousePressed(initiateLevelPlay); | ||
customLevelButton.mousePressed(customLevelLoad); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters