Commit 8fcb9df7 authored by Master Q's avatar Master Q

先这样吧

parent 7cff5819
...@@ -62,9 +62,7 @@ export class ParkourScene extends Scene { ...@@ -62,9 +62,7 @@ export class ParkourScene extends Scene {
initEvents(): void { initEvents(): void {
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this) this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
GDispatcher.addEventListener(ParkourGameEvents.GAME_COLLESION, (e) => { GDispatcher.addEventListener(ParkourGameEvents.GAME_COLLESION, this.onGameEleCollision)
console.log(e.data)
})
this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onGameDetermineMouseDown, this) this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onGameDetermineMouseDown, this)
...@@ -72,6 +70,18 @@ export class ParkourScene extends Scene { ...@@ -72,6 +70,18 @@ export class ParkourScene extends Scene {
// this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onMouseDown, this) // this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onMouseDown, this)
} }
removeEvents(): void {
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
GDispatcher.removeEventListener(ParkourGameEvents.GAME_COLLESION, this.onGameEleCollision)
this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onGameDetermineMouseDown, this)
}
onGameEleCollision(e: FYGE.Event) {
console.log(e.data)
}
onGameDetermineMouseDown(e: FYGE.MouseEvent) { onGameDetermineMouseDown(e: FYGE.MouseEvent) {
const startPos = { const startPos = {
x: e.stageX, x: e.stageX,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment