Updating a parent instance variable

0 favourites
  • 6 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I have a sprite(Sprite A) with an instance variable that should be updated when another sprite(Sprite B) is destroyed. However my current method of updating by storing the UID of Sprite A in Sprite B it is not working properly when two Sprite B are destroyed at the same time.

    Two questions:

    Is there any other way of implementing such a parent-child relationship?

    Is there any easy way of monitoring variables (debug mode) in Construct 2?

  • For debugging I use chrome log plugin, it simplifies a lot of stuff :-)

    It should not matter if two b instances are destroyed at same time, do you use on destroyed trigger? Posting a capx would allow us to help with this.

  • I've requested a parent child model implementation as did another. :(

    Your best bet is to continue using a model to store the UID. Non effecient as it is. it is the only option.

  • <img src="http://i18.photobucket.com/albums/b110/gyger/0002.jpg" border="0" />

    <img src="http://i18.photobucket.com/albums/b110/gyger/0001.jpg" border="0" />

    Here is the code I am using, the initial value for Health is 4 so in theory the final value after destroying all the EnemyTurret_01 should be 0. However, this does not occur when 2 are destroyed at the same time.

  • Here is the code I am using, the initial value for Health is 4 so in theory the final value after destroying all the EnemyTurret_01 should be 0. However, this does not occur when 2 are destroyed at the same time.

    Seems you could do this: add 'for each' loop after health <= 0, OR add 'on destroyed EnemyTurret' trigger where you move the 'pick instance..' - part.

    Also, it seems like your creation method could benefit from containers, or a for loop. You can use loopIndex to pin them to proper imagepoints: Spawn EnemyTurret_01 (image point "Turret_000"&loopIndex) :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That works, thanks.

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