Trying to make a two hit kill enemy

Get help using Construct 2

Post » Thu Jul 10, 2014 5:59 pm

Basically I already figured out the variables for this. ex. When Hits=2 destroy sprite.

What I want to ask is how can I set it up so that way when I blast one of these sprites once it doesn't destroy another sprite of the same type when I hit that one for the first time?
B
10
S
1
Posts: 69
Reputation: 641

Post » Thu Jul 10, 2014 6:07 pm

The hits variable must be instance variables of the enemy.

then you can have an event like

Bullet on collision with another object(enemy) > Enemy , add to 'Hits' 1
-(subevent) Enemy.hits >= 2 , Enemy > Destroy

The collision event already picks the instance that has collided, so if you destroy the enemy inside that event, it will already destroy the right instance.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Thu Jul 10, 2014 6:22 pm

caiorosisca wrote:The hits variable must be instance variables of the enemy.

then you can have an event like

Bullet on collision with another object(enemy) > Enemy , add to 'Hits' 1
-(subevent) Enemy.hits >= 2 , Enemy > Destroy

The collision event already picks the instance that has collided, so if you destroy the enemy inside that event, it will already destroy the right instance.


It works! Thank you!
B
10
S
1
Posts: 69
Reputation: 641


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 30 guests