I am adding mobile support to a game I am making. I can't figure out how exactly love.touch and ID's work.
On PC I have it so that when right is pressed, character moves right and when left is pressed, character moves left.
I would like to recreate this with touch events, when left side and right side of the screen are touched. So touch regions? Is that possible?
Also is touch emulation possible on PC with the mouse.
Git of the project https://github.com/meganukebmp/At-the-speed-of-light
.love below
Need a bit of help with love.touch
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- meganukebmp
- Prole
- Posts: 8
- Joined: Thu Jan 07, 2016 10:38 pm
- Location: Sofia, Bulgaria
Need a bit of help with love.touch
- Attachments
-
- ATSOL.love
- My code
- (5.53 KiB) Downloaded 83 times
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Need a bit of help with love.touch
It works similarly to the keyboard and mouse stuff actually;
you can either use the touchpressed/released/moved callbacks, or [wiki]love.touch.getPosition[/wiki] with [wiki]love.touch.getTouches[/wiki] in love.update.
As for regions, just test whether the touch's coordinates are, in case of left/right division only, smaller or bigger than half the width of the screen in pixels, and act accordingly.
you can either use the touchpressed/released/moved callbacks, or [wiki]love.touch.getPosition[/wiki] with [wiki]love.touch.getTouches[/wiki] in love.update.
As for regions, just test whether the touch's coordinates are, in case of left/right division only, smaller or bigger than half the width of the screen in pixels, and act accordingly.
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.
Re: Need a bit of help with love.touch
In 0.10.x you have a parameter 'istouch' in love.mousepressed.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 6 guests