Jump to content

Object Orientation and Events


cruseyd
 Share

Recommended Posts

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?

 

image.png.5c6a4299b5ddf2cee52df67233a01a33.png

 

Link to comment
Share on other sites

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

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.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...