Last active
December 28, 2021 15:22
-
-
Save vagmi/1bc229918063cd787cd2229f6c443a01 to your computer and use it in GitHub Desktop.
PrinceJS hacks
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
(function() { | |
document.addEventListener("keypress", function(evt) { | |
console.log(evt.which); | |
let state = Phaser.GAMES[0].state.getCurrentState(); | |
let player = state.ui.player; | |
if (evt.which == 116 && player != null) { | |
player.addLife(); | |
}; | |
if (evt.which == 102 && player != null) { | |
player.floatFall(); | |
}; | |
if (evt.which == 107) { | |
let enemy = state.enemies.filter((e) => e.room == state.currentRoom)[0]; | |
if (enemy != undefined) { | |
enemy.die(); | |
} | |
} | |
if (evt.which == 115 && player != null) { | |
player.gotSword(); | |
} | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment