Hour of Scratch 2
Project Goals:
- Changing how the player and background looks
- Changing the music and sound effects
- Adding obstacles that cause the player to lose points
- Adding enemies that will lead to a game-over
I Can:
- Use sensing blocks to check a sprite’s interactions with other sprites
- Use sensing blocks to check keyboard or mouse controls
- Remix existing code to add my own features
1
What is Coding?
Definition: Algorithm is a series of steps to complete a task or solve a problem
For example, ‘make icing’ is an algorithm we can call on again to make a cake, cookie, or cupcake
Definition: Sequence is an ordered series of steps. Computers read and perform commands in order from top to bottom
2
What is Gamification?
DEFINITION: Gamification are elements to game playing that makes it fun. This makes players want to play the game over and over again. This includes point scoring, varying levels, competition with others, and rules of play.
What elements of a game can you think of that makes it a fun game?
3
PacDude
The game we will be remixing is based on the game Pac Man.
Definition: Remixing is taking an existing project and changing it to add your own creativity and spin on the game. Try to add as many gamification elements in todays project!
Pac-Man is a game where the player’s goal is to eat as many coins to gain as many points. the player needs to avoid obstacles or ghosts, otherwise, they will lose points. See how many points you can get!
Player will continue to move in the direction they face. Use the arrow keys to change directions. Avoid hitting the walls, obstacles or ghosts.
4
Starting Algorithm
This algorithm set up how the game starts. We call this initialization (how the game initially starts).
Try changing one line of code at a time and then test your code:
A. Try Changing the Volume.
B.Try changing the starting sound:
C. Record your own starting sound (Ex. “3-2-1”)
5
Setup Algorithm
These algorithms setup the starting point of our player character and the wall theme that will be used.
A. Change the starting point
B. Change the background theme
6
Music Algorithm
This algorithm controls the background music. It plays a sound over and over again inside the forever loop.
A. Try changing the volume
B. Try changing the sound
7
Animation Algorithm
This algorithm controls the animation of our player! This animation is done through using 4 costumes.
A. Change the costume of our player. Make sure the costume ends with “_1”.
B. Try changing the animation speed by changing the “wait” block!
8
Movement Algorithm
This algorithm controls the movement of our player. We control our player using the arrow keys. Having the code wait 0.2 seconds in-between direction changes prevents directions changing at the same time.
Try changing the keys:
Before our player moves, we need to check if we’ve hit the wall or not. If we have, the player will just step back and turn right. Otherwise, our player will just move forward.
Try changing the amount of steps we move forward:
9
Coin Initialization Algorithm
When our game starts, we generate coins around the maze for our player to collect. We do this by creating clones at specific locations on the screen.
A. Add a coin by to the bottom of the algorithm
Extra Challenge: Can you add a line of coins horizontally and/or vertically?
10
Coin Eaten Check Algorithm
This algorithm controls what happens when our player eats the coins. They get a point added to their score and the coin will disappear after being eaten. When all the coins are gone, the game will end!
A. Try changing the sound effect when the player eats the coin:
B. Change the number of points you get for eating each coin
11
Remix and Extra Challenges
You can customize your game by changing the costumes and background to changing how to play the game.
Try the following ideas!
Two Player
We can add a second player to our game easily! Right-click the player sprite and duplicate it. Adjust the code so that player two is controlled using different buttons.
Change the costumes on the second player so that the two players look different!
Remember to add to the code so that both players have their own score and they can both eat the food to get points!
Obstacles & Enemies
Unmoving obstacles and moving enemies can add difficulty to our game! Add two new sprites, one for obstacles and another for enemies. The obstacles should disappear and subtract points when eaten. There can also be a special sound when you eat an obstacle
Enemies can move randomly around the maze and will lead to a game over when touched!
Extra Challenges
- Add levels
- Add power ups
- Add more maze maps
- Add lives
- Add a countdown timer
- Add moving walls to your maze
- Add an item that regenerates PacDude’s lives
- Add instructions in the start menu
What else can you add to your game?
12
Showcase your Work!
Share your game with family and friends.
What did we learn?
Share with us what it is we were able to learn today
13
Where to next?
We offer a number of courses that support what we know and build up new knowledge. You can follow the links below to some of our other course offerings coming up!