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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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