On Screen Joysticks
-
- Prole
- Posts: 1
- Joined: Tue Mar 15, 2016 9:41 pm
On Screen Joysticks
Just wondering if anyone had any idea on how to create on screen joysticks. I am working on a dual stick shooter that I would like to put on android and was just wondering if that was possible with Love2d and if anyone could point me in the direction of finding information on how to do this using Love2d . Thanks
Re: On Screen Joysticks
Doesn't sound too difficult to implement yourself. You'd need to keep track of where the user touches the screen, and from there find the closest virtual joystick center. If the distance is too far, you should probably discard the input. If not, then calculate the distance and direction (probably as a delta-x and delta-y vector, for efficiency), normalize the values, and then use them as input for the game.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: On Screen Joysticks
Also, you can use the love.touch module to actually get the information you want about screen touches. I also recommend searching the projects subforum, since i do faintly remember that someone already created either a lib or a demo application showcasing touch-based on-screen controllers.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests