Animating Direction When Constrained to Mouse Y
Tim_A
Member, PRO Posts: 60
Hi all,
My latest challenge...
I've got an actor constrained to a MouseY integer, so that when the mouse/finger is moved up/down the actor follows.
Is there a way to change the image/animate it when moving left or right?
I realise self.motion.linear velocity Y > 0 won't work??
Regards
Tim
Comments
@Tim_A You could use the trick constrain self.motion.linear to 10*(mouse position-self.position).
If it doesn't work well for your actor you could have this hidden to just change the states.
Edit* Made a quick demo project for you.
Darren.
Wow thank you for that
That's a great effect, and will be very useful for another game i'm building too!
There's a bit of a lag between the actor follow and the mouse position... can that be tightened up or is it a quirk of the approach?
Thanks again, much appreciated.
Tim
Yeah it can be tightened up try changing the 10, i thought you could have the animation rules in here and still use your original code to move/constrain.
Have a game integer or boolean for up so if up is true…..and use this to work out if up is true but have its alpha down to 0 so you can't see it…well that was my thinking behind it
Darren.
Ahhh... brilliant! That'll do it