Jumpy animation

sparx13sparx13 Member Posts: 97
edited July 2012 in Working with GS (Mac)
HI!
I'm in the process of making a game and in the game I've got two actors with an animation that makes it look like they are walking, an attacking animation and a die animation. I've also got a rule so when health is below 1 play the die animation or what ever and then destroy the actor. But when I play it all the animations go well until one of them goes to die, it is really glitchy, the character basically falls over but its glitchy.
I've got a error as well that all of the actors when they spawn if the same actor that has spawned before it has died it will spawn and die as well, when they die away from the enemy actor it dies smoothly(the animation is smooth)

I don't know how to fix this?

Best Answer

  • SolarPepperStudiosSolarPepperStudios Posts: 754
    Accepted Answer
    Here is what I would do for a health bar, I would make 4 (or however many lives you have) sprites for the health bar, each one lower than the last. Every time you character gets hurt and it changes the life attribute I would change the health bar's image. Make sure that the health bar is a global attribute though or it won't work. If you don't like that idea or it does't work then see if @tshirtbooth has a video on it.

Answers

  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Hey,
    can you provide some code or? The error that all spawned die also sounds like that the attribute doesn't get set back, I also wouldn't use spawn since it needs memory usage.
    Is the health attribute an game attribute or an attribute in the actor itself?

    Alex
  • sparx13sparx13 Member Posts: 97
    Ok thanks for the reply. The life attribute is in game, do I need to change it to the actor. If I don't use spawn what else would I use?

    Thanks in advance!
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    If you don't use spawn very often it is okay. I would definitely change the attribute.
    Make one in the actor called "life".

    When self.life <1
    destroy or what you want to have.

    This way when you spawn a new actor, the self.life will be always the value you set. Now you have 1 attribute for all actors spawned. Now each one has it's own :)

    Let me know,

    Alex
  • sparx13sparx13 Member Posts: 97
    I'm not sure how to do this because I have a health bar.
    Help would be awesome thanks!
  • ironDanironDan Member Posts: 148
    Since you're using a Global attribute for health it would need to be reset back to max health before you spawn the next actor of the same kind or that actor will spawn with no health. In this situation I would use a self.health attribute (index) so you can eliminate one Global attribute and solve your problem. As for the health bar it depends on how it gets its data? Im assuming its Global as well and constrained to the actor?? If so then you can always just have the health bar destroy itself when the actor dies and when the actor is re spawned to have a rule in the actor to spawn the health bar containing full health. If you are worried about spawn and destroy as being a resource hog I wouldn't sweat it...its really not as bad as many think.
  • sparx13sparx13 Member Posts: 97
    I'm having a bit of trouble understanding as I am still learning, are you able to give me a step by step tutorial?

    Thanks in advance!
  • sparx13sparx13 Member Posts: 97
    I managed to get the actor to die at the right times. But I'm not sure how to do the health bar because I can't constrain it to the actors self.life attribute and I was confused on what you meant about spawning it and destroying it.
  • sparx13sparx13 Member Posts: 97
    Any help would be great, Thanks.
  • fahrraddachfahrraddach Member Posts: 5
    you have to make the attribute inside of your actor. there where you can also find things like movable or not and fixed rotation and so on. and try to make every actor have its on health bar flying above him and kind of link it to the actor.
Sign In or Register to comment.