Learn to make Mario Game
At now day’s, anybody can make video games without programming. You don’t need to learn Java or C++ to build game. You can use many types of different build tools for various types of games, but one best option is MIT’s free scratch.
You can build game by drag-and-drop using this tool. It is very easy to learn. Let’s see what you can create or build in scratch and then i talk with you how to build simple mario game.
Things to be needed
ALSO READ :- 10 COMPUTER PROGRAMMING JOBS ARE IN DEMAND RIGHT NOW
1> stage – It’s show a quick summary of your game. All backgrounds and sprites which you choose, will appear here. You can also move sprites where you like.
2> Backdrop – Here, you can select backgrounds for your game. You can choose it from Scratch’s library or also paint your own or also import a file. You can also take from your pc camera.
3> Sprites – It’s like backdrops, you can add default or create your own or upload Images also. Click on the little blue I icon to change angle or rename or hide it.
4> Work Area – Where you work in Scratch takes place.
1) Scripts is used for adding code or any blocks.
2) Costumes you create additional poses for your game sprites.
3) Sounds, is the center for editing or adding sounds in game.
ALSO READ :- BEST ANDROID SMARTPHONE UNDER 400$
Creating basic Mario game
Important Note :- I am not a Creator of this game. This is for the purposes of tutorial i am copying Mario sprites from the web. All Mario graphics are owned by Nintendo and you should not publish any game using copyright sprites. This is only for example.
The first step is you have to import sprites and backgrounds import into scratch software.
•Here background images for Mario game
– scratch has best blue sky 3 background, which will work find for us to make game.
Edit Sprite Costumes
-Use image editor to extract the cloud from image which provide above links. Then upload it into scratch. It is not animated, so you don’t need to upload it separate costume.
-For the ground, you need a lots of block images for one stage. So use paint.NET to grab the blocks in the middle of the Ground Blocks, then save them as separate files.
-The coin is an animated GIF. So when you upload it ,scratch will create costumes for every frame of the animation. This image has 11 total frame, but it has a white border around it. So it is not look good because background is blue.
You can download sounds from above links. After download import these all into scratch.
Animate the Coin
Now all parts are ready. We are start with the coins, because it is easy. Our coins are animated GIFs, so we can use it in series and move also.
Making Mario Move
Now it is a hard part of the game. Here many steps are involved in making Mario move. Here is the trick to scroll the background and blocks in the move.
First you need to create four variable in your Data base tab.
– Gravity is a constant that force Mario back to the ground when Mario jumps.
– OnGround keep track the whether if Mario is touching the ground or not.
– ScrollX is measure the horizontal movement of the Mario on the screen.
– Velocity is used for controls the speed of the Mario jumps.
Mario has many more code blocks. This blocks of code change the ScrollX variable of code when Mario go ahead.
Whenever you press left or right buttons, Mario faces in the appropriate direction and take a step.
A simple bit of code that figures out the OnGround variable. If he’s touching one of the ground blocks, OnGround equals 1 (true). When he’s jumping, OnGround is 0 (false).
These two blocks of code handle Mario’s jump velocity. On the left is a block that ensures Mario doesn’t have any momentum if he’s on the ground. If he’s in the air, then his velocity is gradually slowed by gravity, which is a constant value. The right block makes Mario jump whenever you press the space button.
Let’s go ahead on the jump. We need to make sure when Mario jump and grab the coin we need to sound and disappear that coin.
We need to make separate script for that. This is easy, when Mario touches a coin, the coin collection sound plays and the coin hides from there.
Scroll Coins and Clouds
Here almost work Done! When Mario doesn’t move but ground scrolls, we need to make sure coins are also scroll with ground so Mario collect them. Here is show how it works.
The easiest way to do this is to right-click on the stage and click Save picture of stage. Open this in Paint.NET and use the pipette tool to select the blue background color. Add a new layer using the bottom-right dialogue.
Then, use the rectangle tool to draw a filled blue rectangle on either side of the screen. Cover about a half of each block, then delete the background layer. Now save this file as PNG and upload it as new sprite Border.
Now it’s time to expanding your game. If you want to take an easier route to Create Your Own Mario Game project that you can make by drag and drop sprites to make simple game.
Have you expanded our basic Mario game? Leave your question, suggestions and updates in the comments below, please!!