Hi everyone,
I have been trying to figure this out for a couple of days now, and I need some help. Basically, I have a left arrow and a right arrow set up as buttons. I modified the button class to include both "pressed" and "released" events which allow my player to perform a continuous movement if the button is held, and stop if the button is released or the user's finger slides off of the button. Everything works, but the user must take his or her finger completely off of one button before pressing the other button. I want to be able to slide from one button to the other without lifting my finger. In other words, I want an event to fire when I "slide on" the button the same way the event stops when I "slide off" the button. It seems like it should be simple to figure out, but I am missing something somewhere. Thank you in advance for any suggestions.
Comments
So all you need is to listen to MOUSE_MOVE event and check if it hitTarget() or not
So basically attach MOUSE_MOVE listener to your button and inside it check if it hittest points your button
if yes and previously it did not, then its like on click
if it was and now it is not, then its like click release
I tried something similar to what you are suggesting earlier and it did not work. I think I was doing something wrong in the way I was comparing the touch point to the button position. Since I now know that IS the way to do it, I will work on it some more.
Thanks a bunch for the help.
Likes: cokeramirez
https://deluxepixel.com
Likes: SinisterSoft
https://deluxepixel.com
Likes: SinisterSoft
Likes: freessp
https://deluxepixel.com
Likes: SinisterSoft
I have been trying to do the same stuff for ages now, I tried different methods, classes from the forum but one problem remains.
The problem is when I press a button and slide away from it the event is still active! I would like to cancel the event when the finger is not touching the button anymore.
The latest class I have tested is oleg's one from his github.
http://forum.giderosmobile.com/post/quote/7200/Discussion_7200
But the problem remains!
Can somebody help me here?
https://wiki.giderosmobile.com/index.php/Mobile_Controls
The only class that is working as expected is the TNTVirtualPad but it's too complex for me!
"Switching between buttons without lifting finger from the screen"
http://forum.giderosmobile.com/discussion/7200/button-class-is-multitouch#latest
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
I have got my player moving left and right by pressing the buttons, when I press the button and move my finger away from the button the player keeps running!
You just need to handle the clickUP and clickDown event
ps/You probably used -not my button class
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Your class is in the folder classes (you will find it quite easily )
Could you please have a look?
My class checks the finger ID you press, this is important for multi-touch screens
Also my class has some extra features
Likes: MoKaLux
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
folder classes
mobile_test.lua
mobileVOleg.lua
I just put a big transparent button below so I can cancel the action!!!
I am so happy, I have been doing this for days!!!
And @oleg thank you very much for your button class it works "almost" perfectly I just need to add a transparent button to cancel an action.
1.
clickUp--- clickUP!!2.You have an outdated version of my class missing the line there: self:dispatchEvent(Event.new("clickUP"))
3.A move event is not required
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Now I am happy with my hack! Your class helped me a lot! I was going crazy about this annoying little thing!
@oleg do you think I can put your class in the wiki (under mobile control)? Thank you.
Here is my modified class from the last game:
It has other events:
clickDown
clickDown_M --Moving your finger on a button
clickMove
clickUP_M --Moving your finger beyond the button
clickUP
click -- Press and release your finger on the same button
Also, SP and CT can be enabled in the new class
--Button(upState,stopPropagation,ColorTransform)
Button.new(Bitmap.new(Texture.new("img/gui_48.png")),true,true)
DownState image - Adds to button via clickDown event
Likes: MoKaLux
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Github source code link
Thats why I decided to create blurred shapes, and layout (aka window).
So, I decided to create something like Soda. And thats what I got for now:
Alert window call looks like this:
In Codea you have to manually draw objects inside built in "draw" function, but gideros uses absolutely different approach, so you cant port it "AS IS", you need to rewrite 95% to make it work in gideros.
I took the idea of how Soda controls touches and implemented it in gideros style, the rest was written by myself from scratch.
Check Soda source, its very interesting, I think
Likes: oleg, Apollo14, SinisterSoft