Day 6 Unit 2
Unit 2. Platform game – events and If-then statements
Before we start with a new game, let’s share and show the games that you have worked on last week.
- Click Share button on the top of the page.
- Click on +add to studio button at the bottom of the page
- Choose summer code camp 2019.
- Click okay
Wrap-up: Show your project
- click on your account name at the top right of the page.
- Select My Class
- Click on Class Studios – summer code camp 2019
- Check out your friends projects!
Today, we are building a platform game. We will use the concepts we learned last week, events and if-then statements, but the game will be a little more complex.
First we will start by watching this video.
And open up the starter project.
http://scratch.mit.edu/projects/19646592/#editor
We will use events to make the sprite jump.
- Program your player sprite to jump when the up arrow key is pressed.
- Create a condition that says if the sprite is not touching a platform, then it should move down.
- Make the player sprite fall when it is not touching a platform.
Then we will make the sprite move left and right when the arrow keys are pressed.
- Create two key-press events.
- Add two “change x by” blocks to make the sprite move both left and right.
- Add two “repeat until” blocks to make the sprite move more smoothly.
- For each “repeat until” block, create a condition that makes the sprite move until the key is not pressed.