Instance Variables - Not Responding

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

    I successfully managed to add an instance variable to an enemy of 3 health and also managed to take 1 health with the collision of a bullet.

    Problem started when I created a different enemy with the exact same instance variable (with a different name, of course) and the bullets aren't doing anything to him. I've tried absolute everything and it still has a different outcome, although the two enemies are technically identical.

    I'll post a capx here...

    Is this problem familiar to anyone of you?

    Thanks

    3rdclover

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are bullets getting destroyed, or do they pass through? Could be that the origin point or the collision polygon of the hunter is not as it should be (= collision wouldn't happen at the place where the image is).

  • Silly question; Did you set up the "on collision with" events for second enemy and events to subtract from the new enemy internal variable?

    I assume you mean you made a new sprite and added an internal variable of the same name and not just created an instance of the original via ctl-drag or copy/paste..

    If its not an instance it will act completely autonomous of others regardless of internal variable names, events, or action.

  • [quote:2jut0f65]Are bullets getting destroyed, or do they pass through? Could be that the origin point or the collision polygon of the hunter is not as it should be (= collision wouldn't happen at the place where the image is).

    here's a screenshot of the spire editor with the collision area...

    As for the instance variables(iv) question, I've created a new sprite and proceeded to go through the same process as the other enemy, step by step. The only difference is the name of the iv which went from "zombiehealth" to "hunterhealth" to mach the enemy's identity.

    --

  • Problem Solved ---

    Noob mistake nº1:

    Forget to add - hunter > hunterhealth = 0 > Destroy

    Narf!

    --

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