help! how to destroy only one sprite?

For questions about using Classic.

Post » Tue Feb 22, 2011 6:46 pm

help guys ): when i use events to destroy an enemy sprite, construct destroyes all the same sprites on the level.
afcourse there are multiple enemyes, but i want the event to kill only the one that is triggered not everyone ):
B
3
S
1
G
1
Posts: 141
Reputation: 1,007

Post » Tue Feb 22, 2011 7:11 pm

voala, i have detirmined that the WAIT plugin is the problem.
i want the object to destroy itself after 3 seconds when it sees the player.
and it works, but when i add wait 3 seconds it destroyes every enemy of the type
B
3
S
1
G
1
Posts: 141
Reputation: 1,007

Post » Tue Feb 22, 2011 7:50 pm

I have not used the "WAIT" plugin, but I think I have a fair idea of what the specific issue is.

The initial check is a point of reference for which Enemy to destroy. However after 3 seconds, it does not have that point of reference, so it culls the lot. To get around this issue, I would suggest making use of a private variable to calculate the 3 second delay. Something along the lines of


Enemy.value('isSeen') greater than 0 - clamp(Enemy.value('isSeen') + 100 * timedelta, 0 , 300) - Destroy Enemy.

And have an event that is like this

Enemy.value('isSeen') equal to 0 - set Enemy.value('isSeen') - 1

So this will only trigger once, and it will be unique to each Enemy.
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Wed Feb 23, 2011 7:24 pm

thank you, if i encounter the problem again ill be sure to use this, sounds kinda hard right now but ill understand it. i appretiate the help
B
3
S
1
G
1
Posts: 141
Reputation: 1,007


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests