cruseyd Posted October 10, 2018 Share Posted October 10, 2018 I come from a C++ background, so I quite like working with classes in Javascript. I'm building a custom object, extending Phaser.GameObjects.Sprite, and trying to set up the events for it in its constructor (see attached code). The code compiles, but the even simply wont fire! What am I doing wrong? Link to comment Share on other sites More sharing options...
samme Posted October 10, 2018 Share Posted October 10, 2018 http://labs.phaser.io/edit.html?src=src\input\game object\on down event.js Link to comment Share on other sites More sharing options...
cruseyd Posted October 10, 2018 Author Share Posted October 10, 2018 Ah I see... Is the 'click' event just deprecated or something? Is there a resource where I could have found a list of events that are valid for GameObjects? Surely this must exist, but the only API I have been able to find is this: https://photonstorm.github.io/phaser3-docs/Phaser.Events.EventEmitter.html Link to comment Share on other sites More sharing options...
prob Posted October 10, 2018 Share Posted October 10, 2018 You're not directly handling browser onClick or other input events; all input is handled through the InputPlugin.js here. One benefit of this is you're handling both mouse and touch events with a pointer object (or multiple pointers). Input events are in the above link are all emitted from processDownEvents, processDragEvents, processMoveEvents, processOverOutEvents, and processUpEvents methods. blackhawx 1 Link to comment Share on other sites More sharing options...
cruseyd Posted October 11, 2018 Author Share Posted October 11, 2018 For the sake of anyone reading this thread later, here is the correct code in ES6 form: GreenCloversGuy 1 Link to comment Share on other sites More sharing options...
Recommended Posts