In this short article post I will teach you how to make the Pokemon Scratch.
This is a quick, fun Pokemon like game I created today. In short – you play as the Dinosaur sprite, and you are presented with two option. You can either attack to the other sprite or heal yourself, but each decision you make counts as 1 move. The bee will either heal itself or attack you. Feel free to remix this game as you wish. As always, I recommend you taking my online course to better learn how the Scratch editor works. It offers great walk-through tutorials for all the categories and there are tons of awesome examples incorporating different types of blocks. It is worth checking out. Lets begin!
Add two main pokemons to the game.
As usual, start a new Scratch project. Then proceed to change the stage background to stage. It can be found in the Scratch backdrop library. Next download the Dinosaur and the Bee Pokemon Scratch sprite from this article. Or, if you want, you can upload or draw your own ones. Place the Dinosaur on the left side of the stage, and place the Bee on the right side of the stage. Before I start making a program to either of them, paint two separate sprites. Use the text tool and the rectangle box, with outline only, to make the ”ATTACK” sprite. The second sprite should say ”HEAL”. These are going to the options the game will offer as.
I will be playing as the Dinosaur, and the Bee is going to be a computer. Next I will be focusing on the Dinosaur’s script. Start by dding the main event block. Under it place the ‘show’ block to make it appear when the game starts, because the sprite will become invisible when its health is below 0. Also, make it go to this point of the stage by giving the right x and y coordinates for it. Then go to data category and make a variable, call it – Dinosaur Hp. When the game starts, we want the Dinosaur to have 100 health, so, drag the ‘set Dinosaur Hp to 100’ block under the motion block. I hope you are enjoying the Pokemon Scratch Next, from the operators category grab the ‘forever’ loop and the ‘if-then’ statement block. From the operators category grab the ‘less than’ block, and make a statement that says, when the Dinosaur Hp variable block is less than 1, it will hide. Hide means – disappear from the stage, and this will happen when the Dinosaur has lost all his lives. From the event category grab the ‘when I receive’ block, and later, from the drop-down menu, choose attack. The attack sprite will broadcast a message that this block will receive. Just remember to come back here and set it up after the ‘Attack’ sprite has its program ready. And when it does receive this message, make it glide to the opposite sprite in 0.2 seconds, and let it come back to its main position. Awesome, next I am going to script the Bee Pokemon sprite.
Make a script for the game action.
Position the Bee on the right side of the screen and lets start scripting it! Start by adding the ‘when flag clicked’ block. You can copy the Dinosaur’s script to this sprite, because it will be almost the same. The difference here is to make a new Bee Hp variable, and set the Bee Hp to 100 when the game starts, and replace the Dinosaur variable block with the Bee Hp block. Next pick the ‘when I receive’ block. This block will receive a ‘bee attack’ message once the Dinosaur has attacked to it. Here I have made an ‘if-then-else’ statement. The condition picks a random integer between 1 and 2, and if it equals to 1, then the ‘if’ part will run, otherwise, the ‘else’ part will be executed. What the Bee decides what to do is completely random, it will either attack us or heal itself. I use the ‘change Bee Hp by’ block together with the random integer picker, to make it heal in the range of 5 to 15. Now, when the number picker picks 2, the Bee will attack to use and it will cause the Dinosaur to receive an attack damage ranging from 5 to 25. And finally, it glides back to its main position. Next, click on the Pokemon Attack sprite.
Final additions to the Pokemon game.
Grab the ‘when this sprite clicked’ event block. Now, when I click on the Attack button, I want this sprite to broadcast ‘attack’ message to all the game sprites. The Dinosaur’s script is ready to receive this message, and when it receives it, the script below runs, making the Dinosaur charge onto the Bee. Then the Bee’s Hp is reduced, and it can be anything from -5 to -25. Then it waits 2 second, and broadcasts the ‘Bee attack’ message, which the Bee receives. And when it receives it, it knows that Dinosaur has made its turn and is now making its own turn. And finally, the Heal button.
When this button is clicked, it simply changes the Dinosaur’s Hp by an integer that is inside the specified range. This also counts as a turn, therefore it broadcasts the ‘Bee attack’ message, making the Bee make a move – to attack or to heal itself. This is a very cool Pokemon Scratch. The sprites used here are under common creative licence and feel free to remix this game as you wish. Have fun!