forked from Chasmiccoder/acm-rpg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
325b3cd
commit 4bfee38
Showing
22 changed files
with
290 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vs/ | ||
.vscode/ |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class OverworldEvent { | ||
constructor({map, event}) { | ||
this.map = map; | ||
this.event = event; | ||
} | ||
|
||
init() { | ||
return new Promise(resolve => { | ||
this[this.event.type](resolve) | ||
}) | ||
} | ||
|
||
stand(resolve) { | ||
const who = this.map.gameObjects[this.event.who]; | ||
who.startBehavior({ | ||
map: this.map | ||
}, { | ||
type: "stand", | ||
direction: this.event.direction, | ||
time: this.event.time | ||
}) | ||
|
||
const completeHandler = (e) => { | ||
if(e.detail.whoId === this.event.who) { | ||
document.removeEventListener("PersonStandComplete", completeHandler); | ||
resolve(); | ||
} | ||
} | ||
document.addEventListener("PersonStandComplete", completeHandler); | ||
|
||
|
||
|
||
|
||
} | ||
|
||
walk(resolve) { | ||
const who = this.map.gameObjects[this.event.who]; | ||
who.startBehavior({ | ||
map: this.map | ||
}, { | ||
type: "walk", | ||
direction: this.event.direction, | ||
retry: true // if true, then the game object retries its movement after an interrupt (get an npc to start walking again after collision with the player) | ||
}) | ||
|
||
// Set up a handler to complete when the correct person is done walking. | ||
// Then resolve the event | ||
const completeHandler = (e) => { | ||
if(e.detail.whoId === this.event.who) { | ||
document.removeEventListener("PersonWalkingComplete", completeHandler); | ||
resolve(); | ||
} | ||
} | ||
document.addEventListener("PersonWalkingComplete", completeHandler); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.