playMaker

Author Topic: health for enemy  (Read 2965 times)

gamedivision

  • Full Member
  • ***
  • Posts: 227
health for enemy
« on: December 19, 2012, 05:13:38 PM »
ive never seen any questions on this,how would i make health for an enemy character,so if i hit him with a sword it will take away a percentage of health when the health reaches zero he dies.


thank you

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: health for enemy
« Reply #1 on: December 20, 2012, 02:30:20 PM »
A percentage... You might write a math function that takes the current health of your enemy, and an attack factor, which is that of the weapon hitting the enemy. Your enemy would get this attack factor, and have sent that value to an FSM, in the enemy, that calculates the actual damage value and substracts it from the enemy's health. You can, as well, have the weapon deal a specific damage value, so your enemy's hmm... let's say, HealthManager FSM will get that value and substract from the enemy's HP. Does this have any sense for you?
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8