How can you change attributes based on movement direction?
design219
Member Posts: 2,273
Here's my problem: I'm updating my game to add a joystick option. I have the joystick working (finally!), but I have an effect that I want to maintain from the other control setup. The current controls are left, right, up and down with the large arrow buttons. These buttons also change attributes called Left, Right, Up and Down when they are pressed or released.
The main Actor (the Nose) is moved by the buttons, but there are constrained actors (the gears) that move with the nose AND are changed by the different attributes (an animation of them spinning up and down). The below image shows the Up button pushed and the respective gear spinning. A subtle effect, but I don't want to lose it.
So, I need to find the simplest way to change these attributes with the joystick controlling the nose... either detecting the direction the actor is in, or by the actual joystick itself.
Any suggestions?
The main Actor (the Nose) is moved by the buttons, but there are constrained actors (the gears) that move with the nose AND are changed by the different attributes (an animation of them spinning up and down). The below image shows the Up button pushed and the respective gear spinning. A subtle effect, but I don't want to lose it.
So, I need to find the simplest way to change these attributes with the joystick controlling the nose... either detecting the direction the actor is in, or by the actual joystick itself.
Any suggestions?
Comments
_________________________________
HOLY NOSE JOB!: Nesen Probe: Is this the single most unappealing game in the history of GameSalad? I can't seem to give it away! Anywhere. But if anyone want's to try it out, codes are still available near the end of the thread! http://gamesalad.com/forums/topic.php?id=8097
Does the vector to angle do something different with the bottom half of the circle?
up image: >=45 , <135
left image: >=135, <225
down image: >=225, <315
right image: >=315
right image: <45
because of the way GS handles the 360/0 point of rotation I had to do the right image as two separate rules for some reason.
Good luck!
If so, just account for that.
And you will probably need to split the right direction anyway because it wraps around at 0 back to 359...
So:
If angle > 0 and < 45 => game.right = true
If angle > 315 and < 359 => game.right = true
You might need to do a similar thing at 180...
That's it! Thanks guys!
The readout was a great idea, I should have thought about that. A great tool for tracking down such things.
As you can see, it is negative. This will make left and right a multi condition rule, but at least I've got it now.