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

先这样吧

parent 7cff5819
......@@ -62,9 +62,7 @@ export class ParkourScene extends Scene {
initEvents(): void {
this.addEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this)
GDispatcher.addEventListener(ParkourGameEvents.GAME_COLLESION, (e) => {
console.log(e.data)
})
GDispatcher.addEventListener(ParkourGameEvents.GAME_COLLESION, this.onGameEleCollision)
this.stage.addEventListener(FYGE.MouseEvent.MOUSE_DOWN, this.onGameDetermineMouseDown, this)
......@@ -72,6 +70,18 @@ export class ParkourScene extends Scene {
// 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) {
const startPos = {
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