Joystick and animation
MarkOnTheIron
Member Posts: 1,447
I finally managed to understand joystick behaviors thanks to codemonkey example.
Now I'd like to complicate it a little bit, I'd like to show a different sprite (and relative sprite animation if it moves) depending on joystick position.
Is it possible to do using angles? Something like:
if at angle 0 show spirit 0 and spirit animation 0
if at angle 45 show spirit 45 and spirit animation 45
and so on...
Now I'd like to complicate it a little bit, I'd like to show a different sprite (and relative sprite animation if it moves) depending on joystick position.
Is it possible to do using angles? Something like:
if at angle 0 show spirit 0 and spirit animation 0
if at angle 45 show spirit 45 and spirit animation 45
and so on...
Comments
http://gamesalad.com/wiki/how_tos:gsc_move_stop_animate
But instead of just left and right, you would use the angle given. See the DirectionalAnimation(demo) project I've added to the site.
Then returning to the Joystick control demo you made I should be able to Create a constraint attribute to the stick 2 to return me a value between 0 and 8 (or higher if I divide for a number smaller than 45 right?) and then I use this value in a rule in the actor I want to move so that for every number I could trigger a different animation. Would it work? I'm far from my copy of GS and I can't test it.
I managed to have the ball rotate by changing the attribute rotate to game.angle1 but when it start moving now it doesn't stop even if I release the joystick.
Here is an image of the green stick behaviors:
http://img22.imageshack.us/img22/5779/joystick1.png
I will be grateful for any suggestion
If you download it again, there is a scene for just one thumbstick with rotation as well.
http://gamesalad.com/game/play/22929