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

0 favourites
  • 2 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It looks like my question was answered here.

    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

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