Destroy an object on start of layout consequences

Get help using Construct 2

Post » Wed Oct 16, 2013 2:28 pm

Say your layout has an object. In your event sheet, you destroy that object first thing. Then you create some new objects based on that object. What, if any will the consequences be, if any? Erratic behavior? Nothing? I know that the object will successfully be created and manipulated, but while I'm trying to work out bugs, I want to make sure I didn't create any by doing that. Also, I realize that the IIDs and UIDs may change due to this action, just as they would if I destroyed any other object.
B
11
S
4
G
1
Posts: 159
Reputation: 1,803

Post » Wed Oct 16, 2013 3:24 pm

Nothing unexpected. Doing it that way is pretty common and useful.

Only thing you may run into is if you have "On Created" events for that object. As "On created" will trigger on objects before they are destroyed "at start of layout".
B
88
S
14
G
9
Posts: 101
Reputation: 9,962

Post » Wed Oct 16, 2013 3:53 pm

I usually have an objectdump layout where I put all the objects I'll need later but don't want existing to begin with. That way C2 has an instance to referance, and any On Created/Destroyed events won't involve it.
B
47
S
14
G
7
Posts: 603
Reputation: 8,151

Post » Wed Oct 16, 2013 5:46 pm

[QUOTE=EncryptedCow] I usually have an objectdump layout where I put all the objects I'll need later but don't want existing to begin with. That way C2 has an instance to referance, and any On Created/Destroyed events won't involve it. [/QUOTE]

This is a good idea. I do this as well. Makes it easy to keep track and organize. As well as avoid the instance must exist on some layout issues. for whatever silly reason I always end up calling it my ZooLayout.onzephyr2013-10-16 18:05:43
B
88
S
14
G
9
Posts: 101
Reputation: 9,962

Post » Wed Oct 16, 2013 6:57 pm

Ahh, great idea! By putting my 'prototype' instance of the object I'm working with in a different layout, it is not getting involved in any of the stuff I'm doing with subsequent instances. I was not looking forward to making each event screen out the prototype's UID.
B
11
S
4
G
1
Posts: 159
Reputation: 1,803


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests

cron