• Content Count

  • Joined

  • Last visited

Everything posted by BlueLemming

  1. I think the game.destroy() function is still a dummy function in Phaser 3 beta 20. So, in other words, you could either make a build from the Phaser 3 source or just wait till the next release which should be tomorrow.
  2. I was able to make my own quick solution for detecting when a key was first pressed. I used lodash for a helper function, apologies if you don't want to use lodash. You'll just have to rewrite the "getKeyByKeycode" function if so. // snipped from my ES6 Scene class import _find from 'lodash/find' export default class extends Phaser.Scene { create() { this.keys = this.input.keyboard.addKeys({ left: Phaser.Input.Keyboard.KeyCodes.LEFT, right: Phaser.Input.Keyboard.KeyCodes.RIGHT, jump: Phaser.Input.Keyboard.KeyCodes.A }) this.input.keyboard.on('keydown', event => { const key = this.getKeyByKeyCode(event.keyCode) if (key) { if (key.timeUp === 0 || key.timeDown < key.timeUp) { if (key.timeUp === 0) { key.timeUp = 1 } this.input.keyboard.emit('keypressed', event) } } }) } getKeyByKeyCode(keyCode) { return _find(this.keys, { keyCode }) } }
  3. I've been struggling to figure out if the "_justDown" property of a key is working properly or not. It seems to always be true as long as the key is held just like "isDown" when accessed directly (ex: someKey._justDown). It seems that the intention is to use the Phaser.Input.Keyboard.JustDown() getter method, but it returns the same results as key.isDown and key._justDown (ex: Phaser.Input.Keyboard.JustDown(someKey)) If this is a bug then I'm comfortable enough to try and make a fix, but I figured I should first see if I'm misunderstanding how to use it in the first place. (Using Phaser 3 beta 19)