Time for action – implementing touchscreen controls
The game file to import and load for this session is 5961_10_03.stencyl
.
In the Ball Movement behavior, disable the Move Ball event by removing the check mark next to the behavior name as indicated in the following screenshot:
In the Ball Movement behavior, create a new
always
event: +Add Event | Basics | When Updating and rename it toSwipe Control
.Add the instructions as shown in the following screenshot, taking care to ensure that the swiped … blocks' drop-down options are configured as shown, and that the number of degrees in each push self sharply towards … degrees at … force instruction block is entered correctly:
Mac users should skip steps 5 and 6, and move directly to step 7.
Add a new when created event and rename it to
Allow Gestures
.Add the Enable gestures block as shown in the following screenshot:
Ensure that the mobile device is connected, and the correct device is selected in the target device drop-down list.
Test the game...