General discussion about LÖVE, Lua, game development, puns, and unicorns.
3 posts • Page 1 of 1
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
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!
- Party member
- Posts: 2868
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
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.
Users browsing this forum: No registered users and 43 guests