Construct 2 Template Instances (Video)

Discussion and feedback on Construct 2

Post » Wed Jan 21, 2015 1:42 am

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:
https://www.youtube.com/watch?v=ah4QFGYq_o4

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
B
31
S
7
G
8
Posts: 232
Reputation: 6,244

Post » Wed Jan 21, 2015 5:53 pm

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Wed Jan 21, 2015 11:28 pm

@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
B
31
S
7
G
8
Posts: 232
Reputation: 6,244


Return to Construct 2 General

Who is online

Users browsing this forum: Google [Bot], vegapomme27 and 6 guests