Movement - Automatic - Lakelands Computing

Title
Go to content
Making Sprites Move Automatically
Having a sprite move around without any user control can be useful, and is often a key part of a game. The method used is similar to that shown in moving with keys 2.

The key differences are that the direction is set to a random one at the start and the sprite is asked to bounce back of the edges of the screen

The basic idea is you give the sprite a direction and then ask it to move a number of steps. The forever loop keeps it repeating the number of steps.
All Text copyright Lakelands Academy & Mr T Purslow 2020.
All images copyright free / creative commons unless otherwise stated.
You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
Back to content