Time for action – setting up touch events
The handlers so far have all been in the card script, the plan being to have different cards with different types of puzzle. The interactivity handlers can be placed in the stack script, available to all of the cards.
Open the stack script. There is only one global variable that we also need in the stack script, but there are a couple of initializing items to cover. Start the stack script with these lines:
global snapdistance on preopenstack if the platform contains "iphone" then iphoneUseDeviceResolution true end preopenstack on openstack set the compositorType of this stack to "Static OpenGL" end openstack
The
preopenstack
handler checks if the app is on iPhone, and requests that the device's native resolution is used. That will make sure that Retina displays show the best quality. ThecompositorType
being set toStatic OpenGL
will help performance.The interactivity we'll use will make use of touch events. Each touch comes with an associated...