Page 108 - 2502_Pakistan-kifayat_C-7
P. 108
Moving Sprite Manually
Manual movement means that the user directly controls the sprite’s movement by interacting with the
project, usually using keyboard keys, mouse clicks, or dragging the sprite. This is commonly used in
games or interactive projects where the player needs to control the character or object. The movement
is determined by the user’s actions, and the sprite can move in any direction based on those inputs. It
allows for real-time interaction and gives the user full control over the sprite’s actions.
Different examples for moving sprite manually are as follows:
1. Move Sprite while pressing the Right Arrow Key
This code moves the sprite 100 steps forward when pressing the right arrow key.
2. Move Sprite while pressing the Left Arrow Key
This code moves the sprite 100 steps backward when pressing the right arrow key.
3. Move Sprite while pressing the Up Arrow Key
When the up arrow key is pressed, the sprite points diagonally (135°) and continuously turns 90°
right and moves 100 steps, creating a repeating square-like movement.
106 Premium Edition-VII

