is setInstanceClass unique per object type?

0 favourites
  • 3 posts
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • is it possible to set multiple object types to the same custom class? for example

    runOnStartup(async runtime =>

    In the constructor of MoveableEntity i am logging the instance, and i am only getting back the object of type EnemyMask.

    so i am wondering if you can set multiple object types to use the same subclass.


  • OHHHH i know whats going on, I create the player instance through event. this sub instance ctor only gets called when it's created through script. as soon as i created the playerMask instance from javascript the ctor got called correctly. Is that a discrepancy between the event logic and js? will the create action call the subclass ctor?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • is it possible to set multiple object types to the same custom class?

    Yes. You're basically just changing the type of class used with new.

    Note that inside a constructor, the object has not yet actually finished initialisation. It is only in its final state once it has run all super calls, initialised the entire inheritence chain, and then finished the most-derived class constructor. So if you want to inspect the fully initialised state of the instance, you need to check that after creation.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)