60 likes | 125 Views
Game Controls. Collision Detection. Moving with the Arrow Keys. Moving with the Arrow Keys.
E N D
Game Controls Collision Detection
Moving with the Arrow Keys • There are still a few things in the Scratch user interface that you probably have not used yet. Experiment with the rotation controls shown below and make sure you understand the behavior of each. These will probably come in handy at some point!
Moving with the Arrow Keys • To make a character move around based upon the keys that you have pressed. You will need to use one of the rounded "top block" pieces, such as in the example shown below. These can respond to key presses and start a script.
Two characters running! • We are going to make a small game of tag in Scratch. Make a second character that is controlled by a different set of keys. • We want to be able to refer to our characters with intuitive names. By default, your sprites will probably be called things like Sprite1 and Sprite2. Rename them by clicking on the sprite and typing into the text box at the top of the screen, as shown below:
Game of TAG! • We want one of the characters to react if the two characters touch. • Note: One really important thing to note here is that once we click the green flag, the scripts above will always be running: notice that they always have a white outline. Compare this to the script below that would only run once when you click the green flag. The functionality above is often called an infinite loop, and can be very helpful when we want something to continue running forever. OR