Add Visual Feedback
When you play Twelve now, all the action happens when the mouse button is released. When you click on a square and slide the mouse around, nothing appears to happen. In this section, you’ll add highlights to the squares to give users some visual feedback about the move they are making.
First, as the player clicks on a square to begin a move, add a white square highlight to the starting square, as shown in the following image.
This square remains highlighted until the player releases the mouse, reminding the player which square is making the move.
As the player moves the mouse around to different squares, the square that the ...
Get Learn Game Programming with Ruby now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.