# How do I kill enemy only after item has been picked up

0 favourites
• 5 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
• Hi I was wondering if anybody could help me with a game i'm currently developing. I need to find a way to kill an enemy only after item has been picked up. So say its a red coin and the character jumps up picks up the red coin then he is allowed to kill the red enemy characters.

Any ideas??

• Hello, I created a .capx file to try and describe you my way of doing it (Update your software to the lastest version)

What you can do, you can give the enemy an instance vairable, let's call it 'coin', his value will be '0'.

If the bullet is overlapping (or on collision) with the enemy, and the value of the coin is 0, nothing should happen

But, if the coin value is '1' and the bullet is overlapping the enemy, destroy the enemy.

Which means, when we collect the coin, we destroy the coin an change the value of the coin from 0 to 1.

Here's the .capx, hope it helps.

• Absolute Legend! Thank you so much!!

• Absolute Legend! Thank you so much!!

No problem, happy I could help

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Can add a question please :) how can i do this plus before the item the player can no shoot... but after the item it can shoot and destroy?

Claudio

Hello, I created a .capx file to try and describe you my way of doing it (Update your software to the lastest version)

What you can do, you can give the enemy an instance vairable, let's call it 'coin', his value will be '0'.

If the bullet is overlapping (or on collision) with the enemy, and the value of the coin is 0, nothing should happen

But, if the coin value is '1' and the bullet is overlapping the enemy, destroy the enemy.

Which means, when we collect the coin, we destroy the coin an change the value of the coin from 0 to 1.

Here's the .capx, hope it helps.