Skip to content

Commit 11cd615

Browse files
committed
new main menu
1 parent f531816 commit 11cd615

5 files changed

Lines changed: 22 additions & 14 deletions

File tree

public/assets/bg.png

229 KB
Loading

src/game/scenes/Game.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Game extends Scene
3535
loadInteractables(){}
3636
loadUIAssets(){}
3737
loadDecor(){}
38+
loadKen(){}
3839

3940
craftSound: phaserAudio
4041
cartSound: phaserAudio
@@ -52,6 +53,7 @@ class Game extends Scene
5253
this.loadInteractables()
5354
this.loadDecor()
5455
this.loadUIAssets()
56+
this.loadKen()
5557
}
5658

5759

src/game/scenes/GameImpls/Controllables.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ function addControllables(){
2222
}
2323
}
2424

25+
Game.prototype.loadKen = function(){
26+
this.load.spritesheet(
27+
'Ken',
28+
'assets/Ken.png',
29+
{frameWidth: 64, frameHeight:64}
30+
)
31+
}
2532

2633
Game.prototype.createInteractions = function(){
2734
this.physics.add.collider(this.player, this.walls);

src/game/scenes/MainMenu.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class MainMenu extends Scene
44
{
55
background: GameObjects.Image;
66
logo: GameObjects.Image;
7-
title: GameObjects.Text;
7+
playB: GameObjects.Image;
88

99
constructor ()
1010
{
@@ -15,20 +15,17 @@ export class MainMenu extends Scene
1515
{
1616
this.background = this.add.image(512, 384, 'background');
1717

18-
this.logo = this.add.image(512, 300, 'logo');
18+
this.logo = this.add.image(512, 300, 'title');
1919

20-
this.title = this.add.text(512, 460, 'Play Game', {
21-
fontFamily: 'Arial Black', fontSize: 38, color: '#ffffff',
22-
stroke: '#000000', strokeThickness: 8,
23-
align: 'center'
24-
}).setOrigin(0.5)
20+
this.playB = this.add.image(512, 400, 'startB').setOrigin(0.5)
2521

26-
this.title.setInteractive().on('pointerdown', () => {
22+
this.playB.setInteractive().on('pointerdown', () => {
2723
this.scene.start('Game');
28-
}).on('pointerover', () => {
29-
this.title.setFill("#ff4444")
30-
}).on('pointerout', () => {
31-
this.title.setFill("#ffffff")
32-
});
24+
})
25+
//.on('pointerover', () => {
26+
// this.playB.setFill("#ff4444")
27+
// }).on('pointerout', () => {
28+
// this.playB.setFill("#ffffff")
29+
// });
3330
}
3431
}

src/game/scenes/Preloader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ class Preloader extends Scene
3535
// Load the assets for the game - Replace with your own assets
3636
//this.load.setPath('assets');
3737

38-
this.load.image('logo', 'assets/logo.png');
38+
this.load.image('title', 'assets/title.png');
3939

40+
this.load.image('startB', 'assets/startB.png')
41+
4042
this.loadAudio()
4143
}
4244

0 commit comments

Comments
 (0)