Construct 2 Template Instances (Video)

0 favourites
  • 3 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Everybody knows that Construct 2 requires a minimum of one actual instance of every sprite. This first instance is a sort of "archetype instance" for all new instances of that sprite going forward. If you redefine the values of some custom archetype instance's variables, those values are used as the defaults for new editor instances as well as dynamically spawned instances.

    I looked through the manual and forums to see if there was any mention or detail about this and wasn't really able to dig anything up, so I'm presenting my findings for everyone.

    Here is a video I made demonstrating some potential pitfalls and issues with creating archetype instances of sprites:

    TLDW: If you want to setup a archetype sprite with default values for its instance variables and behavior properties, you should do two things:

    • Create an Assets Layout whose sole purpose is to keep one of each archetype sprite
    • Make sure the Assets Layout is FIRST in the list of Project Layouts
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It is known but I can see that indeed the manual does not seem to mention this (also, this affects every kind of objects, not just sprites).

    however I though it was affected by the oldest existing instance in the editor rather than the position of the layout in the list.

  • Aphrodite

    Yeah, every object type is affected except for global types such as Function or Keyboard.

    Near as I can tell, when a project is first opened by Construct, it stores an "archetype instance" of each Object Type in memory.

    After some testing and from the way that the project file (*.caproj) XML is laid out, the archetype instance is simply the first instance (lowest UID value) on the first layer (bottom-most layer) on the first layout in order encountered that contains an instance of the object type (ordered from top to bottom in the Project Window Layout List) parsed by Construct.

    Until a project is reloaded, the archetype instance assignment will not change. Even if you delete the archetype instance, Construct will continue to base new *EDITOR* instances on its properties/values. However, Construct on preview will reparse all layouts for the first archetype instances of all object types, which affects creation/spawn at run-time.

    Also related to this:

    https://www.scirra.com/forum/viewtopic.php?t=123150

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