Return to site

Code a Pokemon Evolution Game in Scratch

Educators & parents: You can do this Hour of Code Activity as a class or students can work on it independently. If you have any questions or need help, email info@codespeaklabs.com.

Attention, animators and gamers! 

Computer Science plays a huge role in all of the video games you know and love. We will be making a game to evolve Pokemon using user input and character animations. 

Today we are going to be using animated GIFs of Pokemon and uploading them into our projects. 

What is a GIF?

A GIF is a type of file used to save images on your computer. It can often be animated which is why we are going to be using them for our game today!  We will be making a game to evolve Pokemon. Our Pokemon will have to collect rare candies to level up and when they reach certain leveld, they will evolve!  

We will be breaking this project into 4 parts: First, we will start by choosing our pokemon and getting all the sprites uploaded to scratch. Second, we will make our pokemon move. Third, we will make a variable to keep track of the pokemon’s level and code our pokemon to evolve at certain levels. Lastly, we will code our pokemon to level up when it collects enough rare candies and animate our sprites.

Let's start coding!

Go to scratch.mit.edu and follow along with the videos below to begin!

Step 1:

Go to https://pokemondb.net/sprites and pick a pokemon with its evolution tree. Download to computer and upload to scratch. Find the rare candy sprite here: https://pokemondb.net/item/all and download and upload to scratch.

Step 2:

Next, we add the movement code to make the pokemon move. We will be using several if then blocks to check if our arrow keys are pressed. When an arrow key is pressed, we will use a motion block to make our sprite move.

Step 3: 

Our third step is broken down into 3 parts:

  1. Make a variable for the pokemon level.
  2. Add code so that when the pokemon reaches a certain level using the variable (in this case, Level 16) it will evolve into the next evolution. Do the same thing if it has a third evolution level. 
  3. Copy code into the other pokemon.

Step 4:

Lastly, we are going to code our rare candy so that when a pokemon touches it, it levels up and the rare candy moves to a new spot. This is achieved by adding another if then conditional to check if the candy and pokemon are touching. Finally, we are going to animate the sprites so that they look like they’re walking.  We will be using the looks blocks to switch its costume.

Congratulations!

You've completed your Pokemon Evolution game and now you can add animated GIFs to any of your coding projects!

Play the completed game below!

Click the green flag below to try out today's Pokemon game! Use the arrow keys so Bulbasaur can collect Rare Candies to level up and evolve!

Want to code another project? 

Code along with the video below to learn how to make a Star Chase Game in Scratch.

If you enjoyed coding with us, check out our YouTube channel for more free coding projects like these! Go to youtube.com/codespeaklabs and be sure to like, subscribe and click the bell icon to get notified of our future videos!