Skip to main content
replaced http://gamedev.stackexchange.com/ with https://gamedev.stackexchange.com/
Source Link

I asked a question [here][1] that's very similar, and received the following answer:

The way to deal with this is to set a timer once the person taps the phone. The most user friendly scenario that you'd implement would look something like this:

  1. When you detect a tap, set a timer (t = timeToRepeat)
  1. On each frame, decrease the timer by dt 3. If the timer reaches zero, move the sprite a tile and reset the timer 4. If the user releases their finger before the first cycle of the timer, move the sprite one tile

Obviously the amount of time that you set your timer to will determine how fast your sprite moves. There are a few variations on this theme depending on the kind of behavior you want as well. For example, you can move the sprite once immediately upon detecting a tap and ignore step #4.

Implementing this would make the user able to tap to move a single time and to be able to move multiple tiles by holding, which I think is ideal.
[1]: How to combine tap and long hold gesture recognizers?How to combine tap and long hold gesture recognizers?

I asked a question [here][1] that's very similar, and received the following answer:

The way to deal with this is to set a timer once the person taps the phone. The most user friendly scenario that you'd implement would look something like this:

  1. When you detect a tap, set a timer (t = timeToRepeat)
  1. On each frame, decrease the timer by dt 3. If the timer reaches zero, move the sprite a tile and reset the timer 4. If the user releases their finger before the first cycle of the timer, move the sprite one tile

Obviously the amount of time that you set your timer to will determine how fast your sprite moves. There are a few variations on this theme depending on the kind of behavior you want as well. For example, you can move the sprite once immediately upon detecting a tap and ignore step #4.

Implementing this would make the user able to tap to move a single time and to be able to move multiple tiles by holding, which I think is ideal.
[1]: How to combine tap and long hold gesture recognizers?

I asked a question [here][1] that's very similar, and received the following answer:

The way to deal with this is to set a timer once the person taps the phone. The most user friendly scenario that you'd implement would look something like this:

  1. When you detect a tap, set a timer (t = timeToRepeat)
  1. On each frame, decrease the timer by dt 3. If the timer reaches zero, move the sprite a tile and reset the timer 4. If the user releases their finger before the first cycle of the timer, move the sprite one tile

Obviously the amount of time that you set your timer to will determine how fast your sprite moves. There are a few variations on this theme depending on the kind of behavior you want as well. For example, you can move the sprite once immediately upon detecting a tap and ignore step #4.

Implementing this would make the user able to tap to move a single time and to be able to move multiple tiles by holding, which I think is ideal.
[1]: How to combine tap and long hold gesture recognizers?

Source Link
pasawaya
  • 261
  • 1
  • 2
  • 15

I asked a question [here][1] that's very similar, and received the following answer:

The way to deal with this is to set a timer once the person taps the phone. The most user friendly scenario that you'd implement would look something like this:

  1. When you detect a tap, set a timer (t = timeToRepeat)
  1. On each frame, decrease the timer by dt 3. If the timer reaches zero, move the sprite a tile and reset the timer 4. If the user releases their finger before the first cycle of the timer, move the sprite one tile

Obviously the amount of time that you set your timer to will determine how fast your sprite moves. There are a few variations on this theme depending on the kind of behavior you want as well. For example, you can move the sprite once immediately upon detecting a tap and ignore step #4.

Implementing this would make the user able to tap to move a single time and to be able to move multiple tiles by holding, which I think is ideal.
[1]: How to combine tap and long hold gesture recognizers?