cruseyd

Members
  • Content Count

    7
  • Joined

  • Last visited

  1. cruseyd

    Object Specific Event Handlers

    Yeah I finally got it to work as I would expect. I think I wasn't clearing my browser cache correctly or something. Thanks for the input all.
  2. cruseyd

    Object Specific Event Handlers

    Mmkay, I'm seeing that in the source code which is useful, but I can't seem to get the specific 'drop' event to fire. How does it differ from 'dragend'? Based on the source code it *looks like* a 'drop' has the semantics of a drag ending inside a valid drop zone, but I can't get it to trigger that way either (but I am able to trigger e.g. 'dragenter' which also requires a drop zone).
  3. cruseyd

    Object Specific Event Handlers

    I've noticed a pattern while rifling through the Phaser 3 example code. Events seem to nearly always be handled globally, but the scene input. For example, in the snippet below from the drop zone tutorial, the code defines a handler for a gameObject being dropped into a drop zone. But what if I have several types of game object which I want to handle being dropped differently? You could put a conditional in the global callback to check what kind of gameObject you're dealing with, or you could give all your gameObjects a callback with the same name (e.g. onDrop(args)), but I feel like there should be a much cleaner solution. Can I define all this functionality in class members for example? Sorry if I've missed something obvious; the documentation for Phaser 3 seems like it's still relatively new.
  4. cruseyd

    Tweening a Container

    Bump. I would like to know this as well. One solution that I came up with is having the container fire an event that adds a tween to all children, but that seems overly complicated.
  5. cruseyd

    Object Orientation and Events

    For the sake of anyone reading this thread later, here is the correct code in ES6 form:
  6. cruseyd

    Object Orientation and Events

    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
  7. cruseyd

    Object Orientation and Events

    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?