How to change an actor image depending on the position of the joystick?

isabelaqisabelaq Member Posts: 28
edited November -1 in Working with GS (Mac)
hello my question is, how to change an actor image depending on the position of the joystick, for example, I move the player to the left with the joystick, how can to change animation when the joystick it on the left and not the same image, and vice versa on the right?

Comments

  • RodericRoderic Member Posts: 145
    Set up an attribute as integer. Then make a rule in the joystick actor, that when it shows 'left' then change attribute to 2, and when it goes "right" set attribute to 3, and when you want it centered set attribute to 1. Then, in the actor make a rule that when attribute = 1 change image to standard image, and when attribute = 2, change image to left facing image, and when attribute = 3 change image to right facing image.

    See if that works.
  • isabelaqisabelaq Member Posts: 28
    Tahnks, =) yea I'm sure if I will serve, but do not quite understand = /, how can show me display the left and right attribute?? Thanks for you help..
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    if you are using the joystick demo then just base it off Game.angle

    which is an attribute already being set by the joysticks position
  • isabelaqisabelaq Member Posts: 28
    :( sorry but I'm too slow, =) thanks for your help, please help me more. I made a rule with the atribute Game.angle how I can be the atribute left, right or center
    thanks again
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    You just have to decide the angles you want to use for each direction greater than 45 and less than 135 would be up etc….

    So your rule would be

    When game.angle is >45 and
    When game.angle is <135
    --Change image to up.png
    Otherwise
    When game.angle in >135and
    When game.angle is <225
    --Change image to left.png
    Otherwise

    and so on...
  • isabelaqisabelaq Member Posts: 28
    ooooo :0 yea =) it is =D thanks
Sign In or Register to comment.