Drak Posted January 18, 2019 Share Posted January 18, 2019 I'm trying to increase/decrease jump height based on how long someone holds down their mouse for. Any tips or code snippets would be welcome. Link to comment Share on other sites More sharing options...
mattstyles Posted January 18, 2019 Share Posted January 18, 2019 Phaser probably won't help you out, but the events will come with a timestamp so you'd need to store the pointerdown timestamp, subtract it from the pointerup timestamp and you have your duration, which you can then turn into jump height. Link to comment Share on other sites More sharing options...
rich Posted January 18, 2019 Share Posted January 18, 2019 In 3.15: this.input.on('pointerup', function (pointer) { var duration = pointer.upTime - pointer.downTime; }); In 3.16: this.input.on('pointerup', function (pointer) { var duration = pointer.getDuration(); }); mattstyles 1 Link to comment Share on other sites More sharing options...
mattstyles Posted January 18, 2019 Share Posted January 18, 2019 Nice, very nice work Phaser! That is a beautiful. Link to comment Share on other sites More sharing options...
Recommended Posts