How to have multiple enemies from the same spawner have individual healths?

I have a spawner producing enemies but Im not 100% on how to get each of them to have individual healths. Right now when I kill one it kills all of the enemies on screen.
Any help would be great! Thanks.

Answers

  • IceboxIcebox Member Posts: 1,485

    @TaylorH1 There is a tutorial on youtube for this , by Ash Jakcson

    I hope it helps and good luck

  • ookami007ookami007 Member Posts: 581

    @TaylorH1 - You can also check out my tutorials and templates on my site, some of them show how to spawn enemies of different health and different color, etc. - monkeyuncle.com

    But, the basics are:

    Create a integer called health in the enemy actor
    Set health to floor(random(1,5)), which will give it varying health from 1-5
    On collision with player or player laser (or whatever), have it deduct 1 from health
    Add a rule that when health < 0, destroy the actor

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I have a health bar demo in the Spare Code thread that does just this. I'm not able to search for it at the moment but let me know if you can't find it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TaylorH1TaylorH1 Member Posts: 8

    Super big thanks guys!!! I think Ive got it the way I need it. but if not I'll let you know. :smile:

Sign In or Register to comment.