|
@@ -2,7 +2,7 @@ import Phaser from 'phaser'
|
|
import Gate from "./Objects/Gate";
|
|
import Gate from "./Objects/Gate";
|
|
import Switch from "./Objects/Switch";
|
|
import Switch from "./Objects/Switch";
|
|
import Button from './Objects/Button';
|
|
import Button from './Objects/Button';
|
|
-import Player from "./Objects/Player";
|
|
|
|
|
|
+//import Player from "./Objects/Player";
|
|
|
|
|
|
|
|
|
|
export default class HelloWorldScene extends Phaser.Scene {
|
|
export default class HelloWorldScene extends Phaser.Scene {
|
|
@@ -18,8 +18,8 @@ export default class HelloWorldScene extends Phaser.Scene {
|
|
// private gatesA?: Phaser.Physics.Arcade.Group;
|
|
// private gatesA?: Phaser.Physics.Arcade.Group;
|
|
private platforms?: Phaser.Physics.Arcade.StaticGroup;
|
|
private platforms?: Phaser.Physics.Arcade.StaticGroup;
|
|
private boxes?: Phaser.Physics.Arcade.StaticGroup;
|
|
private boxes?: Phaser.Physics.Arcade.StaticGroup;
|
|
- private player1?: Phaser.Physics.Arcade.Sprite;
|
|
|
|
- private player2?: Phaser.Physics.Arcade.Sprite;
|
|
|
|
|
|
+ private player1!: Phaser.Physics.Arcade.Sprite;
|
|
|
|
+ private player2!: Phaser.Physics.Arcade.Sprite;
|
|
private cursors?: Phaser.Types.Input.Keyboard.CursorKeys;
|
|
private cursors?: Phaser.Types.Input.Keyboard.CursorKeys;
|
|
//Scene Transition
|
|
//Scene Transition
|
|
private nextScene?: Phaser.GameObjects.Text;
|
|
private nextScene?: Phaser.GameObjects.Text;
|
|
@@ -220,6 +220,9 @@ export default class HelloWorldScene extends Phaser.Scene {
|
|
repeat: -1,
|
|
repeat: -1,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
this.physics.add.collider(this.nextScene, this.platforms)
|
|
this.physics.add.collider(this.nextScene, this.platforms)
|
|
this.physics.add.overlap(this.nextScene, this.player1, this.handleLoadNextScene, undefined, this)
|
|
this.physics.add.overlap(this.nextScene, this.player1, this.handleLoadNextScene, undefined, this)
|
|
this.physics.add.overlap(this.nextScene, this.player2, this.handleLoadNextScene, undefined, this)
|
|
this.physics.add.overlap(this.nextScene, this.player2, this.handleLoadNextScene, undefined, this)
|
|
@@ -386,13 +389,17 @@ export default class HelloWorldScene extends Phaser.Scene {
|
|
if (this.cursors.up?.isDown && this.player2?.body.touching.down) {
|
|
if (this.cursors.up?.isDown && this.player2?.body.touching.down) {
|
|
this.player2.setVelocityY(-330)
|
|
this.player2.setVelocityY(-330)
|
|
}
|
|
}
|
|
- /*
|
|
|
|
|
|
+
|
|
for(let i = 0; i < this.buttonArray.length; i++){
|
|
for(let i = 0; i < this.buttonArray.length; i++){
|
|
- if(this.checkOverlap(this.buttonArray[i], this.player1?) == false){
|
|
|
|
- this.gateArray[this.buttonArray[i].gateID].enableBody
|
|
|
|
|
|
+ if(this.checkOverlap(this.buttonArray[i], this.player1) == false && this.checkOverlap(this.buttonArray[i], this.player2) == false){
|
|
|
|
+ let gateX = this.gateArray[this.buttonArray[i].gateID].x
|
|
|
|
+ let gateY = this.gateArray[this.buttonArray[i].gateID].y
|
|
|
|
+ this.gateArray[this.buttonArray[i].gateID].enableBody(false, gateX, gateY, true, true)
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- */
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|