hit points question

digitalzerodigitalzero Member, BASIC Posts: 639
edited April 2012 in Working with GS (Mac)
okay so what im trying to do is add hit points to the character... but it clearly is not working at all! heres what i have done thus far

i created an integer named "hit points"

i have added this integer attribute to the enemy actors as it deals with the bullets that it would collide with

heres the best way i can explain it

**enemy actor**

if actor overlaps or collides with the actor "bullet" then change attribute game.hitpoints to game.hitpoints +1

under that

if game.hitpoints is =3 (for the sake that i would want the bullet to hit 3 times before the enemy is destroyed) than destroy the actor

but after i do all of this it does not spawn any more actors and i know that the reason is because the attribute is still at a high level so it would not even spawn anything because in the games eyes the attribute is already at three and for the enemy actors who have hit points less than three it would not work... i realize that being the problem but my question is how do i add hit points just for the enemy actors without changing the whole outlook so that it would do it just for the actors that spawn... sorry that was horribly explained but hopefully you know what i mean lol

Best Answers

  • xforcexforce Posts: 187
    edited April 2012 Accepted Answer
    if i understand what you want. are you using self attributes? im thinking not. if not then rather than have the enemies rely on a global attribute you need to create an attribute internally in each actor. its the same as adding a global attribute except you do it inside the actor. when you want to reference the attribute you select it from the down menu and instead of game.hitpoints it'll be self.hitpoints.

    any attributes unique to actors are prefixed with self

    doing it this way each enemy will be solely reliant on its own hit counter to determine whether it dies or not

    is that what you wanted?
  • xforcexforce Posts: 187
    Accepted Answer
    no worries. also you said hitpoints=3. somtimes its better to use the equal or greater than (≥) function instead of equal (=)

    it can cause problems if you have actors/bullets/etc overlapping or colliding very quickly where the number ticks over so fast that the game engine doesnt get a chance to even see the = so it never has a chance to see the conditions for the rule to take effect. so that way if it does go higher your rule will still work

Answers

  • digitalzerodigitalzero Member, BASIC Posts: 639
    thanks so much for that piece of advice... you know i never really understood why attributes would be within the actor or within the whole game but this has given me major insight... thanks so much for the prompt response... its greatly appreciated!
  • digitalzerodigitalzero Member, BASIC Posts: 639
    OMG THANKS! :) YAY! i think i might be able to complete my third game tonight woohoo!!!!
Sign In or Register to comment.