Teaching Coding through Game Creation by Sarah Kepple

Teaching Coding through Game Creation by Sarah Kepple

Author:Sarah Kepple
Language: eng
Format: epub
Publisher: ABC-CLIO


Keyboard Controls

Create a new object, and name it objectBoot. Assign spriteBoot from the dropdown list. We’ll control a single instance of objectBoot using the keyboard. Add a Key Press event, and from the dropdown list choose either Left or, from the Letters submenu, choose A. Add a Move Fixed action to the event and choose the middle-left arrow. Set the speed to 8. Follow the same process to add Key Press events for Right, Up, and Down or D, W, and S. Assign a Move Fixed action to each using the appropriate direction arrow.

We’ve now told objectBoot how to move when each key is pressed, but we haven’t told it when to stop moving. To address this, add a Keyboard event, and select No Key as the trigger. As shown in Figure 5-19, drag a Move Fixed block into the actions area and select the stop square. We don’t need to set a speed.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.