-
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
3203389
commit 6a831e4
Showing
8 changed files
with
114,583 additions
and
39 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
{} |
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
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,31 @@ | ||
class Play extends Phaser.Scene { | ||
constructor() { | ||
super("playScene") | ||
} | ||
|
||
create() { | ||
// change background color | ||
this.cameras.main.setBackgroundColor('#FACADE') | ||
|
||
// add new Hero to scene (scene, x, y, key, frame, direction) | ||
this.hero = new Hero(this, 200, 150, 'hero', 0, 'down') | ||
|
||
// setup keyboard input | ||
this.keys = this.input.keyboard.createCursorKeys() | ||
this.keys.HKey = this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.H) | ||
|
||
// debug key listener (assigned to D key) | ||
this.input.keyboard.on('keydown-D', function() { | ||
this.physics.world.drawDebug = this.physics.world.drawDebug ? false : true | ||
this.physics.world.debugGraphic.clear() | ||
}, this) | ||
|
||
// update instruction text | ||
document.getElementById('info').innerHTML = '<strong>CharacterFSM.js:</strong> Arrows: move | SPACE: attack | SHIFT: dash attack | H: hurt (knockback) | D: debug (toggle)' | ||
} | ||
|
||
update() { | ||
// make sure we step (ie update) the hero's state machine | ||
this.heroFSM.step() | ||
} | ||
} |