Animating a turn around for an actor.

moidschmoidsch Member Posts: 6
edited November -1 in Working with GS (Mac)
I want to play an animation of a turn around when my actor is facing right and I press left on the keyboard / virtual stick.

Ideally this animation would be played till end (6 frames on 12 fps) before the actor being able to move in any direction.

Unfortunately I get him to face right, but with no animation between the poses.

P.S: I tried finding a topic about this and the Google and forum results I've found led me to no clear answer on how to do this.

GameSalad is a truly inspiring tool and the community here seems very interested in helping. Thanks in advance.

Comments

  • moidschmoidsch Member Posts: 6
    Just in case I couldn't make myself clear. I included here an animation sample for the movement.

    http://www.moidsch.com/temp-archive/turn_128_moidsch.gif
  • moidschmoidsch Member Posts: 6
    When left is pressed, the character immediately walks toward left.
    I've adapted the platformer template from gamesalad.

    And it has some attributes like Grounded and FacingRight that help determine his poses.
    The FacingRight attribute is checked by a timer Rule that runs every 0.01 second.
    And I think this may cause some problems. I'll try to study more samples from the game salad community, but if anyone knows how to insert that smooth turn around rule, please let me know.

    Thanks.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    try interpolate the rotation to the direction you want before you move

    example:

    Rule: when key left is down

    -interpolate self rotation to 180, duration of .5

    timer after.5 seconds
    -move left
  • FranzKellerFranzKeller Member Posts: 517
    You might just want to recode, instead of using the template>

    If you try, this definitely doable.

    Use a variable that counts down the animation after each turn.

    ( Could be used for "duck" and "jump" transition animations too)
  • moidschmoidsch Member Posts: 6
    Thanks, JohnPapiomitis and FranzKeller. I'm gonna try both ways.
  • moidschmoidsch Member Posts: 6
    John's tip turned the action in a weird behavior. When I pressed the button, my actor would flip upside down. Didn't work. : /

    I've followed FranzKeller tip and recoded from the beginning every behavior. It took a bit of time, but I've learned a lot about the importance of Timer functions restricting other inputs. Now I know I can set attributes for any action as long as I activate and deactivate it if I don't want them being interrupted by other inputs.

    I've used an attribute to check if the character is facing (named it Face Right) the correct direction and other ('Virada' - portuguese for turn around) for preventing an input while the turn around lasted.

    P.S: Noobs like me, you can name the attributes anything you like. The only thing that matter is that you check that attribute on the other rules so that your conditions are valid for each new move you make.

    Here's what the code looks like right now.

    http://www.moidsch.com/temp-archive/turnaround_solution.jpg.
  • 3xL3xL Member Posts: 676
    sorry for asking, but howcome you are using "constrain attribute" for the virada action? instead of CHANGE attribute? is this better?
  • moidschmoidsch Member Posts: 6
    Sorry for taking so long to answer.

    I believe in this case you could use change.

    But the constrain attribute will keep the change for as while as the action lasts.
    The change just makes one change and stops. I wanted to make sure no other action would interrupt this move and so I thought if I could constrain it, it would be better.

    But I didn't try using change. So, you can try.
Sign In or Register to comment.