How do I set variables in a newly created object

Just started using Construct 2? Post your questions here

Post » Wed May 11, 2016 2:40 am

In something like gamemaker I can do this 'x=instance_create(the thing,x,y);

then I can adjust variables in it with code like x.snazzy = 5

How can I adjust variables in only the object most recently created?
B
51
S
14
G
4
Posts: 191
Reputation: 5,537

Post » Wed May 11, 2016 7:00 am

Any actions under the same event will refer to the same object that was already picked. eg

Image

The second action affects only the object created in the first action.
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 205
Reputation: 3,468

Post » Wed May 11, 2016 6:17 pm

You can also use On-created event to do actions on the object being created.
On created sprite1 set var x.snazzy = 5
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests