Make our character Sprite run left and right with Arrow keys
Make our character Sprite jump on platforms with the Space key
Let character Sprite fall if NOT touching a platform
Add a moving platform and a Lava Pit obstacle
Let our character Sprite reach the Portal to advance to the next Level
Use a Variable and Broadcast message to manage Levels and know when the player wins by getting past the last level
See a list of Challenges to improve the game on your own
Go To: http://scratch.mit.edu/
Go To: http://scratch.mit.edu/studios/585122/ and click Platform Game (Starter)
Notice the sections: Title, Instructions and Notes and Credits
This will make a copy of the project under your name
It's a good practice to name your project something unique
Code your sprite to move left and right with arrow keys
Set left/right orientation and add "point in direction" code blocks
Add "wait" and "next costume" code blocks
Code blocks to set start location, "space" key press, sound and upward motion
Your Sprite should fall if NOT on a platform; use a "not" Operator
Add this new rule for your Sprite with an "and" Operator
Add a starting point, "show" block and a "forever" loop
Click back on "Giga" Sprite; Data -> Make a Variable; name it "Level"
You can move your variable on stage; Add "set variable" block to a start block
This code block checks for Sprite touching "Portal", then increments the "Level" variable and moves Sprite back to start location
Select the "Portal" Sprite; Add code block to change color forever
Select "Giga" Sprite; Add a "Broadcast message block"; Select "new message..."
Name the message "NewLevel" and click "OK"; You will tell other sprites to listen for this message...
Peek at Backdrops tab, then add code blocks to switch backdrops at start and when it hears the "Newlevel" message
Select the "Platforms" Sprite; Look at the Costumes tab
(Note: the "Levels" could have been drawn right on Stage backdrops)
Set the "Platforms" Sprite to listen for the "NewLevel" message and switch costumes depending on the Level
Set the "Moving Platform" Sprite to listen for the "NewLevel" message and change its location depending on the Level
Set the "Portal" Sprite to listen for the "NewLevel" message and hide itself at the end; This is why we added a "show" block upon start
Select "Danger1" Sprite; Click the "Info" icon and check the "show: " box
Add code blocks to animate costumes and "show" on Level 2 only (if-then-else)
Right now, nothing! We need to code that back on the "Giga" Sprite!
We only created 3 Levels; so the last backdrop is "You Won" and all Sprites are hidden with our "NextLevel" message and Level = 4 code logic (except for "Giga").
You built a platform game! Now, here are a few Challenges:
Build more levels (backgrounds, platforms, obstacles)
Add special platforms (like springs or transporters)
Create a variable to track number of lives and end of game
Add items to pick up for points or more lives
Add music or more sound effects
Add velocity for more realistic Sprite movement
Add a "Start Over" button
If you got stuck anywhere, see the completed project with comments here: http://scratch.mit.edu/projects/34001904/!
/