How to make a Flappy game on Scratch

Hello! I will Teach you how to make a Flappy game on Scratch!

What you’ll need

  • A computer, so you can do it 🙂
  • Offline Scratch or/and a Scratch account, Click here to go to Scratch!
  • A MIND, so you know what you’re doing.
  • Internet, so you can follow this Tutorial.

Now lets get started!

1.Make a new Project and delete the Cat.

IMG_2818

2. Make a new sprite for the player

IMG_2819

3. Make sure you have 3 costumes: Alive, Flap and Dead

IMG_2820

4. Draw your background with 3 costumes: Menu, Playing & Retry.

IMG_2821

5. Make the Pole Sprite and make sure it has two costumes like this, one up and one down

IMG_2823

6. Now Who said this was an art class? We are now about to start coding! First in the Stage, add a “when start clicked” block and a “switch costume” block after. Set the costume to menu.

IMG_2825

7. Make three variables: IsDead, Score & Velocity. Set IsDead to NO and Score to 0. We don’t have to worry about velocity yet. Add these two blocks after the costume block.

IMG_2827

8.Add a “wait until” block and set the Boolean with “key space pressed”. Add a costume block and switch it to Playing. Put a “broadcast and wait” block and set it to broadcast ‘game’. Add these after the variables.

IMG_2828

9. Your stage code should look like this.

IMG_2829

10. Now go into the flappy sprite or ‘sprite 1’ and add these blocks: “when i receive game”, “set size to (200)%” and “show”.

IMG_2830

11. Add a “when start clicked” and “hide” block with it. Add the “go to” block you see below to the end of the “show” block.

IMG_2831

12. Add the code below so the flappy bird can check if it wants to flap.

IMG_2832

13. Now that the birdie broadcasts flap. insert the code below. it is:

when i receive [Flap],

set [Velocity] to [10],

repeat until <<touching color> or <touching [Sprite2]?>>{

change [Velocity] by (-1),

change y by (Velocity),

}[].

, equals next line, or if this is confusing just look at the picture below.

IMG_2834

14. Now go to the Pole sprite and add “when start clicked” and “hide”. Also add the code below.

IMG_2835

15. Make sure your code from the last step now looks like below!

IMG_2836

16. Go back in sprite 1 or the flappy sprite and add this after the “key space pressed” “broadcast flap” or look at the picture below.

IMG_2837

17. Now to make it look like its flapping add this code before the “change velocity by -1”.

IMG_2838

18. Test out your game. So far it will let you play if you press your space and flap if pressed space, but when you hit the ground or pole the game stops. 😦

IMG_2839

19. Add this code to your pole sprite.

IMG_2840

20. OMG its step 20!!!! Add a “clear graphic effects” block after the “show” in the “when i receive” block.

IMG_2841

21. In the stage. Add the following code.

IMG_2842

21.5. Now save and call it a good name! If you’re offline and don’t have a scratch account or if you’re not a Scratcher yet, skip the last few steps otherwise you may continue.

IMG_2843

22. Go online into your scratch account then open your project or make a new one and upload it.

23. Now make a new variable called highscore and set it as a cloud variable.

IMG_2844

24. Add the following code in the stage.

IMG_2845

25. Now play with your friends and family and see who can go the highest. You can also add some other code like music and maybe the poles could go faster each time, Its up to you.

Farewell Scratchers! Check out my profile!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: