Skip to content
Open
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"predeploy": "npm run build",
"deploy": "gh-pages -d dist",
"preview": "vite preview"
},

},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
Expand Down
16 changes: 16 additions & 0 deletions src/Scenes/HelloWorldScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Button from '../Objects/Button';
import Player from '../Objects/Player';
//import Player from "./Objects/Player";

import { TextButtonObject } from "../Objects/TextButtonObject";


export default class HelloWorldScene extends Phaser.Scene {
//Sprite creation
Expand All @@ -24,6 +26,8 @@ export default class HelloWorldScene extends Phaser.Scene {
private nextScene?: Phaser.GameObjects.Text;
//reset
private resetText: Phaser.GameObjects.Text | undefined;
//menuText
private menuText: Phaser.GameObjects.Text | undefined;

constructor() {
super('HelloWorldScene')
Expand Down Expand Up @@ -223,6 +227,18 @@ export default class HelloWorldScene extends Phaser.Scene {
this.resetText.on('pointerdown', () => {
this.scene.restart();
});

// back to main
this.menuText = this.add.text(40, 10, 'Menu', { fontFamily: 'Arial', fontSize: '32', color: '#ffffff' });
// menu Text touchable
this.menuText.setInteractive();
// menuText
this.menuText.on('pointerdown', () => {
this.scene.start('BaseScene');
});



}

//Handle buttons
Expand Down
21 changes: 15 additions & 6 deletions src/Scenes/LevelTwo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import Button from '../Objects/Button';
import Player from '../Objects/Player';
//import Player from "./Objects/Player";

import { TextButtonObject } from "../Objects/TextButtonObject";


export default class LevelTwo extends Phaser.Scene {
//Sprite creation
Expand All @@ -23,6 +25,8 @@ export default class LevelTwo extends Phaser.Scene {
private nextScene?: Phaser.GameObjects.Text;
//reset
private resetText: Phaser.GameObjects.Text | undefined;
//menuText
private menuText: Phaser.GameObjects.Text | undefined;

constructor() {
super('LevelTwo')
Expand Down Expand Up @@ -230,12 +234,15 @@ export default class LevelTwo extends Phaser.Scene {
this.physics.add.collider(this.buttons, this.platforms)
this.physics.add.overlap(this.player1, this.buttons, this.handleHitButton, undefined, this)
this.physics.add.overlap(this.player2, this.buttons, this.handleHitButton, undefined, this)
// reset touchable
this.resetText.setInteractive();
// monitor reset
this.resetText.on('pointerdown', () => {
this.scene.restart();
});

// back to main
this.menuText = this.add.text(40, 10, 'Menu', { fontFamily: 'Arial', fontSize: '32', color: '#ffffff' });
// menu Text touchable
this.menuText.setInteractive();
// menuText
this.menuText.on('pointerdown', () => {
this.scene.start('BaseScene');
});
}

//Handle buttons
Expand All @@ -262,10 +269,12 @@ export default class LevelTwo extends Phaser.Scene {
return;
}


// sence transition
private handleLoadNextScene() {
this.scene.start('EndScene')
}

//ThreeScene
//private handleLoadNextScene(player1: Phaser.GameObjects.GameObject, sA: Phaser.GameObjects.GameObject) {
//this.scene.start('ThreeScene')
Expand Down