Check instance variable for only one object?

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi there!

    I have an enemy with an instance variable. If you kill the enemy, the enemy dies. However, if you kill the enemy and the instance variable is set to 1 for that specific enemy, I want it to spawn a coin when it dies.

    I've tried this:

    Player collide with enemy and instance variable is set to 1 - spawn coin.

    And I've also tried this:

    On enemy destroyed and instance variable is set to 1 - spawn coin.

    The problem is that when I do this, even the enemies with the instance variable set to 0 also spawns a coin when they die.

    What is the best way to make sure that only the one with the instance variable set to 1 will spawn a coin when destroyed/died?

    Thanks in advance,

    Tommy

  • Sounds like you're doing the right thing, must be a problem with the structure of the events so let's see a screenshot :) or alternatively make sure in debug view that those variables are definitely set correctly and not for example all set to 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • lionz - Yeah it works now, it was just me being stupid. Thanks for replying :)

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