I’m working on converting one of my games from using the mouse input to using a touchscreen instead, but I have no experience with the touchscreen scripting commands. I’m trying to figure out how to approximate the same thing I was doing with the mouse:
There’s an 8x8 grid of tiles, each with a collider and a script with an OnMouseOver() function. When the mouse is over the object, it will watch for the mouse button status and register one of several things:
- Clicking and holding the left mouse button starts drawing a path (marking the tile as the first tile in the path)
- Dragging the left mouse button over another adjacent tile continues the path onto that tile
- Letting go of the left mouse button completes the path
Since the touch controls don’t work the same way, I need to know the best way to approximate the same thing. I already know that I should break all of the path functions out of the OnMouseOver() function and into separate functions (so that I can trigger them separately from the mouse and touch controls). What I don’t know is how to use the touch controls to:
- Register which tile was touched
- Register which tile the finger was slid onto
- Register which tile the finger was over when it is lifted
Anyone have suggestions on how I can proceed with this?