Fortunately, it did not take long to figure this out, but as a beginning java programmer using libGDX, I couldn’t quite figure out the difference between isTouched and justTouched right off the bat. A Google search actually told me the answer, but at the time I did not understand what that answer meant, or when you might use them.

So, to dumb it down for simple folks like me:

  • justTouched – When used in a render method, it will only count the first time you touch the screen, like a “touch down”, but does not render “holding down” the screen. It also does not care about “touch up” or releasing the screen. You might use this to tap an object that you want to register the tap, but do not want it to continue registering that you are holding it. This could be useful to pop a balloon in a game, tap a button, click on something, etc.
  • isTouched – When used in a render method, it will continuously count that you are touching the screen until you let go. This allows you to “hold down” on the screen. Some examples that I could think of for use might be drawing with a paintbrush, turning a page, a button that must be held down, pushing a rock uphill, etc.

Both of these tools have their places, and I could see reasons to implement one or the other depending on your needs. Hopefully that helps someone else out there.

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *