GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Change animation when hit obstacle

johanesadikajohanesadika Posts: 11Member
edited November -1 in Working with GS (Mac)
How to do change animation when hit obstacle and then after a few seconds it get back to the first animation? I'm so lost..

Comments

  • Rob2Rob2 Posts: 2,402Member
    The easiest way is to have each animation sitting inside a rule, or even just one rule if you have only two animations and then make use of the otherwise section.
  • johanesadikajohanesadika Posts: 11Member
    im a newb .. how to use otherwise thenn?

    i had trouble like this..

    i have an actor animate "like running" then if the actor hit another actor it change the animation to "like jumping".

    i use like this..

    making boolean attribute. choose false as default
    Rule :
    when game.animation = false i
    -animate "running"

    Rule :
    -when overlaps or collide X
    --chg.atrribute game.animation = true
    --timer , for = 2 seconds
    ---animate jumping

    then when i hit preview trouble came , it running until it collide X then animate running and jumping at the same time .. how to solve this?
  • BlackbirdStudiosBlackbirdStudios Posts: 493Member
    Maybe you should say when it overlaps or collides. Change attribute game.animation to true. When game.animation is true, animate jumping, and after 2 seconds change attribute game.animation back to false.
  • Gamer1992Gamer1992 Posts: 83Member
    the otherwise rule is under the rule, just click on the word other to expand it. then insert a rule from the behaviours tab
  • johanesadikajohanesadika Posts: 11Member
    the animation got problem now...

    my actor animate like "running" then when i hit an "speed up" actor ,
    it will change the animation to another picture and speed up ..

    it will speed up for 2 seconds..

    But problem appear. the animation doesnt change to default after 2 seconds.. how to solve this?

    i make a boolean attribute "animation" . set false as default.

    i got rule like this...

    rule: -when game.animation = false
    --animate running (15 fps, loop)

    rule : -when overlaps speed up
    --chg att to true --timer = FOR 2 seconds UNCHECK run to completion
    ---animate = "running faster" (15 fps , loop)
    ---chg att = linear.velocity.y to linear.velocity.y+500

    the "running faster" animation just play 'a blink of time' and then it wont change back the velocity to default .. >.< im so lost in here.. stuck since yesterday...
This discussion has been closed.