Junkbots - Moving the bot

 Activity 5 - Moving the bot

When the block with the flag is placed, whatever is under it, is what the program will do when the start flag is clicked. In the case of our game, the bot will move to position (0, 0). These are the coordinates of the main screen. You can change this to whatever coordinates you like, to make the bot have your own starting spot. 

Once you have decided where you’d like your bot to start, it’s time to work out how the user will move it around the screen. This will be an input from the user. Using the Control blocks with the motion blocks, you can control what happens when a user presses a certain key. In this example when the up-arrow key is pressed our bot looks up and moves in the Y direction by 10. If you wanted the bot to move left or right, then the X coordinates would change. You can play around with how much you want the bots to move with each step using the motion block.

Start your new project, and try make your sprite do the following:

  • Go to a position of your choice when the green flag is clicked. 

  • Move up when the up-arrow key is pressed

  • Move down when the down arrow key is pressed

  • Move left when the left arrow key is pressed 

  • Move right when the left arrow key is pressed


Comments

Popular posts from this blog

Junkbots - Introduction

Junkbots - Spawning some rocks