Day 3 Unit 2

Unit 2. Platform game – events and If-then statements


In this unit, we are building a platform game. We will use the concepts we learned last time, events and if-then statements, but the game will be a little more complex.

First we will start by watching this video.

https://csfirst.withgoogle.com/c/cs-first/en/game-design/platform-game/platform-games-intro-and-design.html

And open up the starter project.

http://scratch.mit.edu/projects/19646592/#editor

We will use events to make the sprite jump.

https://csfirst.withgoogle.com/c/cs-first/en/game-design/platform-game/use-events-to-make-the-sprite-jump.html

  1. Program your player sprite to jump when the up arrow key is pressed.
  2. Create a condition that says if the sprite is not touching a platform, then it should move down.
  3. 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.

https://csfirst.withgoogle.com/c/cs-first/en/game-design/platform-game/move-the-sprite-left-and-right.html

  1. Create two key-press events.
  2. Add two “change x by” blocks to make the sprite move both left and right.
  3. Add two “repeat until” blocks to make the sprite move more smoothly.
  4. For each “repeat until” block, create a condition that makes the sprite move until the key is not pressed.