How to determine if screen touched more than 2-3 times in 1 sec
I have a game...found a possible exploit can be used to players advantage.
How can I determine if user is just tapping at a high rate on screen to make a Boolean true ?
My error can take place with as little as 2 taps on screen writhing a one second period. If not "cheating" the system...user should only need to press the screen only once within a 1.5+ second period.
Small window I know. I think I can make the user have to wait maybe a .5 second longer making it up to 2 seconds before user can touch again.
Pretty sure I could use a counter and timer but I would have to reset timer every time they touch.
I was thinking... Normal game touch...start timer...if tapped add 1 to "tapped" counter....
If attribute timer is less than 2...and taps are greater than 2...
I can make the timer start after an actual game attribute "goal" is met so otherwise it would just keep resetting timer every time they touch....which again would allow them to tap within the 2 second time limit I create. Very confusing.
Comments
If I am following you correctly, you could create an attribute that stores the time when the game should start allowing taps again. (Lets call it OK2TapTime.)
When (touch is pressed) and (game.Time > OK2TapTime)
___Change Attribute: OK2TapTime To: game.time +2
___Do your game stuff
Hmmmm ok that actually makes it more of a permission to play vs monitoring what I was referring to. Is that correct ? I'd rather let them tap all they want and the error not occur.
I would still be using a timer and counter correct ?
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Yes, this is a let them tap all they want and the error won't occur kind of fix.
As far as I can tell (without seeing actual code), this is what you are looking for.
There is no need to count how many times they tap. At least it seems that way. You only want them to be able to tap again when 2 seconds has elapsed since the timer started.
Yes. It's a kind of match game...you touch a symbol and then for about .5 sec it searches for more adjoining symbols that match...they explode and others fall into their place...where they can then search for the next symbol. All of this from first tap to second tap takes about 2 seconds.
Thank you. I'll try this as soon as I can.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
can't you monitor when the others have stopped moving?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I can't seem to. They seem to fall at the correct speed and spawn after the correct number of adjoining symbol are found and destroyed but....it seems like the "engine" or something has to take some time to look at the tables and the spawn them to fill the gap. I feel like during this "thinking" it changes the minimum number of required adjoins symbols and allows anyone to just tap anywhere very fast and blocks keep falling...symbols keep destroying...score keeps increasing until the level has been beat. :-(.
To answer your question @The_Gamesalad_Guru although there is a block counter...it keeps counting all the blocks that have been spawn throughout all the levels...which is great I want that as a leaderboard number.
There is suppose to be no more than 48 symbols on the scene when a person is allowed to start tapping.
i can't figure out how to make it count to check there is 48 on the scene or I could simply set a rule when pressed AND when 48 symbols are present...let the game do its thing...then basically ready to go again.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
So do you want a constant restriction on when an input will be recognized again after every input.
Or just when a certain state of the game is happening, then restrict it?
If the former, @RThurman solution seems great. One thing about that method tho, if the touch area needed each time is the same, you can just hold down the touch area to kind of "cheat" again.
Follow us: Twitter - Website
I tried several times...first the best I could understand @RThurman suggested but it did not work. In fact it halted any chance of ANY combination of adjoining symbols/jems
Here is a screenshot.
As you can see top left...currently there are 0 of 3 minimum adjoining jems chosen....if I tap any one of the three bananas on the 4th row, for .05 seconds it searches for adjoining blocks that match. If it finds three I have met the minimum required number of adjoining "blocks" and they are destroyed. The block spawner actor off scene then knows somehow there are blocks missing and fills the gap by dropping them in place. Blocks fall at a self.fallspeed of .05 secs.
When the minimum of three get destroyed it takes about .5-.75 secs to fill the gaps...so this all takes place within about 1 sec. If it finds say...23 adjoining picks and destroys them...it can take a full second to fill the gap.
while all of those are being destroyed my display top left counts up...to 23...and as the gaps are filled they count back down to 0.
So this seems to be exactly where the error can occur...as it counts back down...it takes about .25 seconds to do so....during that time I can tap a symbol of one...with no adjoining symbols and because my counter see at least two adjoined symbols it allows me to destroy a single symbol...now tap real fast and it just keeps happening. I can end a level in about 10 seconds. :-(.
I could send a project to someone if you feel the edge to understand what's happening. I understand they may not be free...this is when I have to just try and figure it out til I do or put the project on hold until I can.
Tha is for everyone's advice.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
@Thunder_Child I can take a look at it if you'd like, I'm bored as crap atm with nothing to do but sit on my butt.
Fortuna Infortuna Forti Una
Oh cool once again you da man ! I'll send it to you. In about 20 minutes.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
I can take a look as well. (I am curious to see why my recommendation does not work.)
There are two or three other ways to approach this. One other way might be to disable tapping when a match is detected, and restore tapping once everything settles down.
@Thunder_Child -- Thanks for sending me the file in a PM. I took a look and think I see what you want.
The basic idea is to let the matches all run their course and the new blocks fall into place before the game will start detecting taps again. Right?
What you can do is make a game-level attribute (type = real) and call it something like "OK2TapTime"
Then in the block's touch rule change it so that it says:
When (all)
__Actor received event: Touch is Pressed
__Attribute: game.Time > game.OK2TapTime
Then down in the rule that detects that there are enough matches and the block actor can be destroyed just put the following change attribute behavior.
Change Attribute: game.OK2TapTime To: game.Time + 2
Try placing it just before the Spawn Actor "Big Explosion FX" action.
And thats it.
It will keep the user from being able to tap on a block until 2 seconds have elapsed since the last explosion. (If thats too long just shorten it to 1 second and see how that feels.)
Awesome I will do exactly as you say there. Will do tonight. Thank you
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing