Enemy health

I am looking for help with my project. I am making a shoot em up game where the main actor is at the bottom scrolling side to side, and the enemies scroll from left to right at the top. How do I make enemies have health where when they are destroyed the new enemies that spawn reload their attributes and not destroy themselves automatically because the read 0 health.

Comments

  • PaxPaxPaxPax Member Posts: 106
    I think this is what you are asking for:

    You use the change attribute behaviour. After your enemy is destroyed and when you are spawning another enemy, use the change attribute behaviour to set the attribute back to its original/starting number.

    cheers
  • belcsbelcs Member Posts: 6
    So would I do this in the same rule? For example I created a rule that when enemy overlaps or collides with the bullet - minus enemy health attribute. Then the next rule is when enemy health is equal or less than 0
    - destroy actor
    - spawn explosion
    - add player points
    - drop power up
    Where would I put the reset enemy health back to 100%?
  • belcsbelcs Member Posts: 6
    At the end of this rule I guess, I will try that thanks a lot brother! That makes since now that I think about it.
  • PaxPaxPaxPax Member Posts: 106
    Yep, it should work.

    cheers
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You need to use actor (aka "self") attributes instead of game attributes. Instead of changing the value of game.health when an enemy is hit or destroyed, change its own self.health.

    For more, see the tutorial link in my signature. I have a full YouTube playlist that shows how to make a shooter.

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

Sign In or Register to comment.