animation after killing enemy, before destorying

MarcoColMarcoCol Member, PRO Posts: 279
edited October 2012 in Working with GS (Mac)
Hi,

I have an enemy-actor, which is animated. So if the actor was hit by a shot-actor, there should be played another animation for explosion and at the same time, there should be displayed a point-text. After 1,5 sec the actor should then be destorey.

It works only for half by me. The problem is, that the animation after hitting the actor will be played a piece of a second and then the normal animation will be played again. But after 1,5 sec it will be destoryed. What is there wrong?

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Maybe think about totally destroying the regular player actor right away and show a new, different, death actor for the death animation.

    Jamie
  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi,

    hmm. There must be still an error inside.

    Currently I have change to the idea of UPTIMISTIK:

    If actor collide with shot
    - Change Attribute Score +100
    - Timer 1 sec
    - Animation (explosion; without loop & without restore...), Check the run to completion box)
    - Display Text
    - Timer 1 sec
    - Destroy actor

    So now, if the shot hits the actor, the text will be shown very short and the actor does have in change the old animation and then the explosion animation and then the old and so on.
  • MarcoColMarcoCol Member, PRO Posts: 279
    ???
  • ashtmjashtmj Member, PRO Posts: 405
    Inside your enemy actor make a new attribute called "dead"

    when the enemy actor is hit by whatever kills him, change self.attribute "dead" to true.
    then put the normal animation within a rule, make the condition of that rule "if self.dead is false"
    then put the death animation in the "otherwise" of that rule.

    If I'm reading right, the problem is that GS is trying to play both animations at the same time
  • MarcoColMarcoCol Member, PRO Posts: 279
    Not at the same time, but with only a part of a second between them. I will check this tomorrow and post, if it works.
    Thank you for now.
  • MarcoColMarcoCol Member, PRO Posts: 279
    It worked perfect. Than you ASHTMJ.
  • MobileRocketGamesMobileRocketGames Member Posts: 128
    edited October 2012
    Actually, it would be simpler to just spawn a new actor that contains only an animate behavior, then destroy your original actor. This is the simplest and probably most efficient way to do things. For its position you just tell it to use the same coords. Only requires two behaviors, (spawn/ detroy).

    You do not ever, EVER, want to use timers if you don't absolutely have to.
    They are resource hogs.
    Timers are for Chumps
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Actually, it would be simpler to just spawn a new actor that contains only an animate behavior, then destroy your original actor. This is the simplest and probably most efficient way to do things. For its position you just tell it to use the same coords. Only requires two behaviors, (spawn/ detroy).

    You do not ever, EVER, want to use timers if you don't absolutely have to.
    They are resource hogs.
    Timers are for Chumps
    I still think timers are more efficient than spawning/destroying actors. They used to be in the past, that's where the push for recycling actors came from.
Sign In or Register to comment.