Discuss Scratch

Miniman637
Scratcher
43 posts

How to make a Mario Game

My name is Miniman637 and this is a tutorial!

In this tutorial, we will learn how to make a Super Mario game. Note: Bookmark this tab so you can follow my tutorial!
We will start with setting up the sprites, and variables. You'll need the Player sprite, which is Mario. And you'll need to set up assets, too. Entities, blocks, enemies, all we need!

Miniman637
Scratcher
43 posts

How to make a Mario Game

You want a thumbnail and a play button. The game needs to start when you click it. I also wanna add some cool size-changing when touching mouse-pointer or not.

whenclickedgotox:0y:-81foreversetbrightnesseffecttotouchingmouse pointer?*10ifdistancetomouse-pointer<50thenchangesizeby190-size/5iftouchingmouse-pointer?andmousedown?thenchangesizeby150-size/5waituntilnotmousedown?playsoundFinger Snapbroadcaststartelsechangesizeby150-size/5
Miniman637
Scratcher
43 posts

How to make a Mario Game

Now let's go ahead to the actual game. Mario will have to start at the left of the screen. Then he'll have to move with the arrow keys. When he hits the center, he'll stop and the level will have to scroll.

whenIreceivestart levelgotox:-240y:0setscrollxto0ifxposition>0thenchangescrollxbyxvelsechangexbyxv
Miniman637
Scratcher
43 posts

How to make a Mario Game

We have to add touching sensors to Mario. So they need to follow Mario, and detect Mario to stop when they detect it. There needs a top, bottom, right, and a left.
Here's the right one:

whenclickedforevergotox:x positionofPlayer+10y:y positionofMario

whenclickedforeveriftouchingLevel?thensetrightsenseto1elsesetrightsenseto0
Miniman637
Scratcher
43 posts

How to make a Mario Game

Now here's the left one:

whenclickedforevergotox:x positionofPlayer-10y:y positionofMario

whenclickedforeveriftouchingLevel?thensetleftsenseto1elsesetleftsenseto0
Miniman637
Scratcher
43 posts

How to make a Mario Game

Now here's the top one:

whenclickedforevergotox:x positionofPlayery:y positionofPlayer+10

whenclickedforeveriftouchingLevel?thensettopsenseto1elsesettopsenseto0
Miniman637
Scratcher
43 posts

How to make a Mario Game

Last but not least, the bottom one:

whenclickedforevergotox:x positionofPlayery:y positionofPlayer-20

whenclickedforeveriftouchingLevel?thensetdownsenseto1elsesetdownsenseto0
Miniman637
Scratcher
43 posts

How to make a Mario Game

Now we are actually going to make Mario move with the arrows! This is my favorite part, by the way. Is it yours, too? OK, let's not get too carried away, we've got scratching to do.

whenclickedforeverifkeyright arrowpressed?thenpointindirection90ifrightsense=0thensetxvto8elsesetxvto0


whenclickedforeverifkeyleft arrowpressed?thenpointindirection-90ifleftsense=0thensetxvto-8elsesetxvto0


whenclickedforeverifkeyup arrowpressed?anddownsense=0thenplaysoundJumpiftopsense=0thensetyvto11elseifdownsense=0thensetyvto0changeybyyv

Last edited by Miniman637 (June 13, 2024 04:24:14)

Paddle2See
Scratch Team
1000+ posts

How to make a Mario Game

Hello! It's great that you want to help out other Scratchers. However, I think we have enough guides in the forums at the moment. Please feel free to welcome new Scratchers on the group welcoming topic or on individual topics created by New Scratchers.

Other places that can always use more helpful Scratchers like you, are the "Help With Scripts“ and ”Questions About Scratch" areas - please use them as designed, by responding to topics created by folks with problems to solve

Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.

Powered by DjangoBB