Need help with capturing tap and double tap

I need some help with a tap / double tap rule I'm trying to create.

I want the player actor to jump when the player taps once and fire when the player double taps.

I can capture the tap with no problem.

I tried setting up the double tap by doing the following

If touch
-- If touchcounter > 0
----- set fired = true
----- set touchcounter = 0
-- else
----- set touchcounter = self.timer + 1

If touchcounter > 0 and self.timer > touchcounter
-- jump = true
-- touchcounter = 0

So, my logic is...

If they tap it, it first checks to see if touchcounter > 0 (meaning it's been tapped already within the last second). If it's true, it means they've double tapped and it sets the fire event and sets touchcounter back to 0 otherwise it means they haven't tapped in the last second so this is a possible single tap and sets touchcounter to self.timer + 1 (1 second)

The second rule checks for touchcounter. If the self.timer is greater than touchcounter and touchcounter is NOT 0, that means they haven't tapped a second time in the last second so it was a single tap and sets the jump action and then resets touchcounter back to 0

I get the jump event... but the double tap / fire event never kicks off

Any ideas or suggestions on how I can get this to work?

Comments

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659
    edited July 2014

    I'm confused by your method for detecting a double tap, there is a simpler way.

    When touch is pressed

    Change TouchCount to TouchCount +1

    Change TouchTimer to Self.Time

    Another Rule

    If Self.Time is > TouchTimer + 0.2

    change TouchCount to 0

    This way you can have a rule
    If TouchCount = 2 or If TouchCount = 1

  • ookami007ookami007 Member Posts: 581

    @erockross - I'm confused by your method.

    So, I'm assuming you poll it when you check the self.time is > touchtimer

  • ookami007ookami007 Member Posts: 581

    Hmm... this is an action game and it doesn't seem to responsive at .2 seconds check and .1 doesn't seem to get the double click.

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    @ookami007‌ no this just let's you see how many sequential taps have been made.
    Every time you tap it adds to the count and records the time that tap was made, if you make the taps within .2 seconds of each other it records another tap. If .2 seconds pass with no taps it resets.
    I think you may need to rethink your controls. The issue with .1 seconds is not that gamesalad can't detect it but that most people can't tap that fast.
    Something like single tap double tap detection isn't great for an action game when it is for actions that need instant response. If you want the game to wait to jump by waiting to see if it is going to be a double tap then your jumps are going to be delayed always, no way around it.
    If you don't want to use onscreen buttons maybe consider gestures that don't require much of a delay to check for. Like tap to fire swipe up to jump.
    Hope that helps.

  • ookami007ookami007 Member Posts: 581

    @erockross - Thanks. I think I came to the same conclussion last night. I'm just going to have to make different parts of the screen do different things.

    I appreciate the help and the insight.

Sign In or Register to comment.