unique sprites?

0 favourites
  • 6 posts
From the Asset Store
2d mushroom sprite 2d game character enmy sprite game art
  • A while ago I tried making a game where it spawned 3 sprites (enemies) which was of the same sprite, just 3 copies. When I shot one of them, a health bar would appear beneath them. But when I did shoot them, the health bar appeared below all of the enemies. As if that wasn't enough problem, the health-bar was changing on ALL of the bars, even though you just shot one of the enemies.

    I was thinking if there is a way to make a sprite unique or something? Because that might fix it, right? Or is there another way to do fix so not all change?

  • It would help a lot if you'd give the example capx ..

    Where you store the enemy health? Is it a instance variable or global variable?

  • i43.tinypic.com/11cftp2.png here's how the eventsheet looks like.

    I use instance variables on the enemies

  • just create a "for each enemy" event and put all the events but the bullet on collision as subevents.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You'd also need a way to tell C2 which healthbar you'd want to affect.

    Easiest way would be to give the healthbar an instance variable uid and set it to the uid of the enemy.

    so add an action to the healthbar create event.

    healthbar set variable uid : enemy.uid

    and add this condition to the enemy variable check events:

    healthbar compare variable uid = enemy.uid

  • As an efficiency point.. You don't need to check/set the health bar on each tick, just set it once after the bullet have been hit and health is lowered.

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