Destroying actor when health bar disappears

skippyskippy Member Posts: 106
edited November -1 in Working with GS (Mac)
Hi I'm trying to figure out how to destroy my actor after the health bar has come to the end and vanished, i made the health bar after watching tshirtsbooth's video and everything works well when the actor collides and the health bar shrinks but iv'e searched and can't work out how to destroy the main actor after the life bar is gone ?
I'm assuming it would be another constrain attribute and when the health bar size gets to zero destroy this actor but i'm not sure.

Comments

  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    you need to create an attribute, name it "Destroy 1".
    go on your life bar and create rule when self.size.X = 0
    change attribute "Destroy 1" to 1

    Then go to the actor you want to destroy:
    create rule:
    when attribute "Destroy 1" = 1
    destroy actor

    i think that should work if i have actually understood what you are doing :)
  • skippyskippy Member Posts: 106
    Thank's giacomopoppi
    it worked a treat and while i got you you might know this as well, if there is a following actor to the main actor that was destroyed and you want the following actor to fall down when the main actor is destroyed how would i do this. I tried change velocity 270, move 270, accelerate 270 and the following actor remains on the screen where the main actor was destroyed but i can't get it to fall but i can destroy it when the main one is destroyed, is this due to the constraining attributes ?
    So in the "following" actor this what i did :
    create rule, attribute game.lifebar = 0
    destroy this actor (which works)
    but none of the above work, and i would prefer the following actor falling rather than destroying, any idea's ?
  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    I don`t exactly know, how your settings are made, but you can just reset every attribute, which is tied to the main actor when the main actor is destroyed and use change velocity, but don`t forget to set the direction to 270 relative to scene, so it really falls.

    Reseting everything can be also done with the same attribute, which is used to destroy the main actor.
  • skippyskippy Member Posts: 106
    Hi Hunnenkoenig, the following actor is the one i want to fall not the main one which does get destroyed and disappears how i want it, it is the following actor with the constraining attributes to make it go where the main actor go's that i think are stopping it from falling down. I feel like i have to disable those attributes to make the move or change velocity work then they just enable again when you start again.
    For example if there is a fish tank on the screen and a fish inside the tank, the constraining attributes keep the fish in the tank (self .position.x) to (game.Target x)and (self.position.y) to (game.target y) and this is in the main actors attributes as well ,when the tank gets destroyed the fish stays where the tank was destroyed where as i want the fish to fall down and iv'e tried different combinations but everything i try the fish remains where the tank was destroyed what do you think ?
Sign In or Register to comment.