How do I pick the last created item in an action?

Get help using Construct 2

Post » Sun Dec 06, 2015 1:16 am

I'm trying to make a bejeweled clone and would like to be able to set a couple of dynamic properties for each gem that's being created in a for each loop using a "System.CreateObject" action which places a random gem sprite over each cell in a grid. I'd like to refer to the last created gem sprite to set it's dynamic properties but I'm not sure how to access it after it's been created without creating a new event. Isn't there some kind of local variable scope or closure in an action for objects created in the same action?

My hope is that since the end result is javascript we can enjoy a similar kind of variable scope inside Construct as well. I'm probably thinking about this the wrong way, but am just trying to wrap my head around the basic rules.

Thanks,

Ben
B
18
S
6
G
2
Posts: 19
Reputation: 1,808

Post » Sun Dec 06, 2015 2:01 am

It looks like my question was answered here. viewtopic.php?t=73647&start=0#352637
But this brings up another question. I'm using a family of Gems to select a random gem from a group. Do I still refer to the newly created object by the family object?

Thanks,

Ben
B
18
S
6
G
2
Posts: 19
Reputation: 1,808


Return to How do I....?

Who is online

Users browsing this forum: MuchaDev, tetuan, tikuna and 4 guests