User Input
Mithat Konar
February 29, 2016
Download starter project
Keyboard interaction
Keyboard events
Checking if right or left arrow key is pressed.
Blocking if both keys pressed.
Keyboard events with boundary checking
Check boundaries the same way as before.
Adding up/down motion
Reassigning keys
Mouse/touch interaction
Move on click
Move circle to where user clicks (on mouse down)
Compensating for the size of Sprite.
Move circle to where user clicks (on mouse up)
Dragging with a mouse
Click on the circle and drag it.
Note that it’s now the circle
that’s listening for TOUCH_MOVE events rather than the game
. TOUCH_MOVE events happening anywhere but on the circle will not be processed.