Here is some code that will help illustrate the problem…
count = 0
if touch.state==BEGAN then count=count+1
elseif touch.state==ENDED then count=count-1
When touching the screen, the ‘count’ variable changes to the number of fingers currently touching the screen. If one finger is added or removed from the screen at a time then the ‘count’ variable is increased or decreased by 1 each time, and the ‘count’ variable changes to zero when no fingers are touching the screen.
When two fingers touch the screen at the same time and then are immediately removed from the screen, the ‘count’ variable changes back to zero immediately. However, if three fingers touch the screen at the same time and then are immediately removed from the screen, it takes much longer for the ‘count’ variable to change back to zero. Also, if three fingers touch the screen at the same time in quick succession the ‘count’ variable will increase beyond 3, and will not then reset back to zero when no fingers are touching the screen. This only happens with three fingers, and not with four, five, six, seven, etc…
I have also noticed a problem when using three fingers in the “Multi Touch” demo that comes included with Codea. It takes much longer for the circles to disappear from the screen when using three fingers, compared to touching the screen with any other number of fingers at once. Also, if I tap on the screen using three fingers in quick succession then some of the circles will remain on the screen.
This is (probably) due to the magic triple-tap triple-touch which is built in to Codea. A triple tap with three fingers will ensure that the on-screen buttons are visible. It’s very useful for when running a project with
displayMode(FULLSCREEN_NO_BUTTONS) as it means that if the project goes wrong, it is still possible to exit back to the editor.
So when you touch with three fingers, Codea waits a bit to see if you’re doing the triple-tap.
Ok, that most likely explains why this problem is occurring. I didn’t know that Codea had this feature built into it.
Unfortunately this feature causes major problems when using three fingers in some projects that are created in Codea. I do have a couple of suggestions that could help solve this though.
Create a simple toggle option in Codea preferences to turn this feature on/off.
Create an advanced option in Codea preferences to change how this feature should be activated, with number of fingers used, tap positioning on the screen, holds and swipe gestures, etc. Maybe we could program our own gestures for this feature like in my code example below?
I sometimes use the following code to bring up the buttons when in full screen mode. A single finger triple tap can be used in the bottom right corner of the screen to show the buttons on the screen, then a single tap anywhere on the screen to make the buttons disappear again. Because of the fact I have limited the triple tap feature to the bottom right hand corner of the screen, I can triple tap anywhere else on the screen and the on-screen buttons will not appear.
if touch.x>WIDTH-32 and touch.y<32 and touch.tapCount==3 then
displayMode(FULLSCREEN) else displayMode(FULLSCREEN_NO_BUTTONS)
If I have any problems using this code in any of my projects, such as projects that include tapping repeatedly in the bottom right hand corner of the screen, then I just change it to something else. In most cases this feature works fine though.