In this part, we move our spaceship until it touches the edge.
We will move our spaceship 3 units at a time in the direction it’s facing until it touches the edge of the screen.
First setup the constraints for moving until the edge is touched. We accomplish this using a looping construct and a sensing block:

Now we add the following code block to move the ship:

It’s setup is shown here:

It is important to note that you don’t need to understand how the codeblock above works, only that it moves the ship 3 units in the direction it’s pointing!

Our final scenario is shown below:

Next: A simple Game! – Part 4
© 2019 Vedesh Kungebeharry. All rights reserved.
[…] Next: A simple Game! – Part 3 […]
LikeLike