1. Scorrimento laterale dei giochi e affermazioni "Se-altrimenti"
Transcript
Hey, and Welcome to Scratch Games day 8. Today you’ll create a side-scrolling game whilelearning about if-else statements. You might be familiar with recent side-scrollinggames, like Helicopter and Flappy Bird. You’ll notice that in these games, the sprite onlymoves up and down. The illusion of moving forward is created by moving the background.
To create today’s game, you’ll also learn about if-else statements.
“If-else” statements are very similar to if statements. Remember, an “if” statementreads like this:An “if ELSE” statement reads like this:“If-else” statements are useful because they let you specify a default action.
Watch how “if-else” statements are used to program video games.
In “Tetris,” the best-selling video game of all time, the user must manipulate fallingshapes to arrange them into rows. IF the user presses the down arrow, the falling shapesfall down really fast. ELSE, they fall down at the regular speed. An if-else statementis useful here because the falling shapes need to do one action all the time, but switchto doing another action when something specific happens.
In Plants vs Zombies, the user must defeat waves of zombies using plants with specialpowers.
IF there is a zombie near the scaredy shroom, it cowers down and doesn’t shoot.
ELSE, it continuously shoots at the zombies. Just like the creators of those popular games,you’ll use if-else statements to build your project today. In this game, a sprite is controlledusing an if-else statement. For example, If the space bar is being pressed, then go up.
Else, go down. Before moving on to the next screencast, clickand open the starter project link next to this page and add a player sprite. You maywant to choose a sprite that looks like it’s flying, like a parrot, bat, or butterfly.
Once you’ve completed this screencast, move on to the next screencast to learn how tocreate a scrolling background.
1. Scorrimento laterale dei giochi e affermazioni "Se-altrimenti"
2. Creare uno sfondo scorrevol
3. Far andare il pappagallo su e giù
4. Perdere e vincere al gioco del surf nella caverna
5. Componenti aggiuntivi Gioco del surf nella caverna
Accedi per monitorare i tuoi progressi e ottenere i distintivi
PlantsVsZombies Gameplay by ACraft Ofisöl (https://www.youtube.com/watch?v=W7WiIfGCSGw) is sotto licenza CC-BY 4.0 (http://creativecommons.org/licenses/by/4.0/)
Flappy Bird Gameplay on iOS by luigi442wii (https://www.youtube.com/watch?v=As-5sPilIx0) is sotto licenza CC-BY 4.0 (http://creativecommons.org/licenses/by/4.0/)
Original Flappy Bird Gameplay by AnanasDan (https://www.youtube.com/watch?v=JuMBu3dLDSo) is sotto licenza CC-BY 4.0 (http://creativecommons.org/licenses/by/4.0/)
Tengen Tetris NES Gameplay by Kingsirluke HD (https://www.youtube.com/watch?v=3TuvQp-yrbg) is sotto licenza CC-BY 4.0 (http://creativecommons.org/licenses/by/4.0/)