Noobish Object picking question

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hola amigos,

    Ok seriously, can you guys tell me what do you think should happen with this?

    <img src="http://i1081.photobucket.com/albums/j349/Djordhan/foreach1.png">

    I would expect all instance of Foe to be checked every time a Friend is destroyed then set each Foe's target value to 0 if its current target equals the destroyed Friend's UID.

    Currently, only one instance has its target value reset to 0. Result, some Foe will continue shooting at already destroyed target forever.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try removing the for each, it's not needed. When you compare a variable it checks all the instances unless some were filtered before with another event.

  • Well, sorry, I found my problem. The issue was the events order. The target was reset to 0 then further down in the event sheet, set back to the UID of the destroyed Friend.

    Which is strange since the Friend was destroyed before Foe's target would be set, so I don't understand why Foes detected the destroyed Friend.

    Anyway, I put the target reset logic at the bottom of the sheet to fix it. But I hate not understanding something

  • Objects are not truly destroyed until the end of each tick. Its somewhat of a design flaw of construct. So, you can still access the location, pv's, etc, for destroyed objects until the end of that event sheet, though I believe you won't be able to pick it after the event where it was destroyed is over

  • Well, the Foe seems to pick the destroyed object even after the end of the Destroy event. It uses an Overlapping at offset condition and was still picking it. So you're right in saying that objects are still "pickable" until the end of the tick no matter what.

    That's a very useful information thank you You're very.. lucid!

  • ...I believe you won't be able to pick it after the event where it was destroyed is over...

    ...you're right in saying that objects are still "pickable" until the end of the tick no matter what...

    Well I was wrong about the pickablility for the remainder of the tick, but you were wrong about me being right about it. So...

    ...glad I could help!

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