About Frogger Game on Scratch:
In this article we’ll learn our own version of classic Frogger Game. The Goal of the Frogger game is to get the frog home by crossing the road and river and getting to other side.
The player guides a frog which starts at the bottom of the screen, to his home in one of 3 slots at the top of the screen. The lower half of the screen contains a road with motor vehicles, which include cars, trucks, bus etc. speeding along it horizontally. The upper half of the screen consists of a river with logs, alligators, and crabs, all moving horizontally across the screen. The player must act quickly to reach the destination before the time expires.
How To Play:
Use the arrow keys to move your crab across a busy street without getting hit by a car. If the crab is hit, you’ll be sent back to the beginning. If the crab makes it safely across the street, you win.
The game starts with three, five, or seven frogs lives, depending on the settings used by the operator.
Lets sketch out Frogger Game on Scratch:
- Create the Background
- Add Cars and Other Vehicles
- Define the Functionality of Moving Obstacles
- Making the Frog Move
- Add Winning and Losing Condition
- Keeping the Score and Lives
- Adding Sound to the Game
Frogger Game on Scratch Code
Create the Background
Click on the paintbrush icon in the backdrop tools to draw your own road background that looks like what you see here Or download the project file from the below link.
The backdrop will include three scenes, the first for the game, the second for victory and the third for game over.
Making the Frog Move
We are going to move the frog using the arrow keys on the keyboard. We want Frog to move all four direction. Program your Frog Sprite to move in the left, right, up and down direction, when arrow key pressed on the Keyboard.
Add Cars and Other Vehicles
Its time to add cars and other vehicles to our game. The car is continuously running from left to right side. we want to create the illusion that cars keep on coming. Now we want to create busy road so that it will be harder for the frog to cross.
Open the Sprite Library. Select the Car, Truck, Bus, Scooter or any other vehicle sprite of your choice. Add them as costume to your vehicle sprite.
Define the Functionality of Moving Obstacles.
Instead of creating many repeating objects, the good programming practice is to subprogram the functionality of the moving vehicle. This function receives various parameters corresponding to the costume , coordinates and direction. Pressing the green flag triggers the ” Move car ” function 5 times and all the vehicles obstacles will appear at the same time and each one in its specific position.
Make sure first that the programming works correctly before copying the functions to avoid dragging possible errors.
Add Winning and Losing Condition
Every game has winning and losing condition. Program your sprite for the same.
What happens when frog hit by the car?
We don’t want the frog to get hit by the car, but if it happens, we need to set the frogs position back to the starting position.
What happens when frog reach the home?
we will return the frog to the starting position whenever the frog and home collide.
Keeping the Score and Lives
Its time to keep score! we will grant 100 points for each time the frog gets home. we use variable ‘Score’ to keep score.
We use a ‘Lives’ variable to count the lives. In the beginning of the game, the frog gets three lives. Each time the frog is hit by a car, the frog loses one life. we subtract 1 from the variable each time the Frog loses a life.
Adding Sound to the Game
Lets Add sound to our game. When the Frog gets hit by the car we can play a failing sound, or when the frog gets home we can paly a success sound.
We can change the speed of the car, so that some cars will drive faster than the others, making it harder for the frog to cross the road. the variable speed changes the speed of the sprite.
Download Frogger Game on Scratch Project Files:
To download the project files of the project How How to make Frogger Game on Scratch Click here. Also go through the another interesting scratch 3.0 project of Animate Your Name using scratch 3.0 here,