I saw this asteroids clone for android where you can rotate the ship with a touch input wheel/circle: you move your finger on the wheel/circle and the ship rotates accordingly. Is there a tutorial or a template where it's explained how to do it?
https://play.google.com/store/apps/deta ... FREE&hl=it
This should be easy.
Touch is touching Wheel
------------------> Ship set angle to angle(Wheel.X, Wheel.Y, Touch.X, Touch.Y)
You can add lerp for smoother rotation:
Ship set angle to anglelerp(self.angle, angle(Wheel.X, Wheel.Y, Touch.X, Touch.Y), dt*8
By the way, the best Asteroids game I've seen is Pew Pew. It's so cool!
https://play.google.com/store/apps/deta ... wpew&hl=it
It works clockwise but not so much counterclowise. How do I tell the computer when the object is rotating counter-clockwise?
Could you share a screenshot of your events, or capx file?
https://www.dropbox.com/s/dfz3wgjpbw97o ... .capx?dl=0
Fixed:
https://www.dropbox.com/s/puggs1it2qped ... .capx?dl=0
Develop games in your browser. Powerful, performant & highly capable.
Thanks, bro. But I don't understand why yours works while mine doesn't.
I tried with a different sprite than the arrow and it stops working.
Wait, maybe I got it. I have to rotate the sprite at 0 degree!
The image in your sprite should be facing right (at 0 degrees).
Also angle(x1, y1, x2, y2) and angle(x2, y2, x1, y1) are not the same thing!