Tuesday, April 2, 2013

The Evilness of Programming a Multi-touch Display

Don't get me wrong, I love using my Ipad. The joy of dragging things, tapping the screens in games, collection dropped loot. All these thing have a tactile feel to them enhancing gameplay. Now the down side. It is a pain in the rump to program for these actions. Here is a simple breakdown on my touch events.

trap begin touch
     is the begin touch player --- are you going to drag to move, do you just want to get the player
                                                  info or just show the tiles where they can move.
     is the begin touch the menu ---
     is the begin touch enemy ---
     is the begin touch a unexplored tile --- is the tile adjcent to the player, if not ignore and wait for
                                                                   ended state to begin moving the player
     is the begin touch an explored tile --- display tile info or move the player (to be determined in
                                                                 prototype)
     if the tile is the inventory button or pause, or a action card or inventory slot

check moving touch state
     if selected object is dragable -- set begin x y position of object
                                                   -- set begin touch x and y and subtract current touch x and y for tile
                                                      offset, then check screen cordinates for dragable area and end drag
                                                      is outside of the defined area.
     if not dragable ignore the moving touch
     if a map is dragable dag all elements in the map to add dragOffsetX and dragOffsetY so they move
     together.

check the ended touch state
     if a dragable object was moving and released on a target object save target object and process the
     correct reaction to the release state.
     if object is released on a non target reset the position

This basic outline is just for a single touch and not a 2 finger rotate, or a pinch zoom, and I don't even want to think about a swipe gesture system.

No comments:

Post a Comment