2D Mario Clone Game Tutorial (Part 2)


2D Mario Clone Game Tutorial (Part 2)

mario

 

Part 1

Play Demo

Thank you for your interest in 2D Mario Clone Game Tutorial. We will continue to develop Mario.

We created some animations for Mario character such as walk, stand and jump. Lets create the world and some mobs. You can get sprite sheets from Part 1 or you can get your own sprites from google etc.

At first, we are going to create 4 animations (question mark, coin, plan and mob). You know how to do it.

Screen Shot 2015-04-27 at 11.40.33

Screen Shot 2015-04-27 at 11.40.55

Screen Shot 2015-04-27 at 11.41.07

Screen Shot 2015-04-27 at 11.41.37

For plant character, we need a auto-move animation for vertical movement. First do the basic animation with sprites to open-close its mouth. Then, open scene and animations windows, place plant at the bottom of pipe, press REC button on animations window. Now you can record the movement animation. Click second 1.0 and drag plant upward, then click second 2.0 and drag plant downward. Click REC button again. It’s done.

Now, lets move the mob. Create a C# script named Mobs and edit it.

Add Box Collider 2D and Rigidbody 2D to mob. Click “Fixed Angle” in Rigidbody 2D. As you see, this script uses names of objects in collision function. So, change script with then names you use.

If you create a question mark box, be careful when you add Box Collider 2D.

Screen Shot 2015-04-27 at 12.01.19Β  Β Screen Shot 2015-04-27 at 12.03.05

Create an empty game object and add bricks and box in it. Add a Box Collider 2D for parent object. Collider of question mark box should be a little bit down. We don’t want to summon mushroom while walking on it. Create a C# script named Mushroom and lets summon our mushroom.

 

This script moves and destroys the mushroom.

Now, we should edit Mario script. Mario should get bigger when he collects a mushroom, he should die when he hits a mob or plant. Also we should summon a mushroom when Mario hits the question mark.

 

Edit your Mario script with this. And assign objects.

Screen Shot 2015-04-27 at 12.14.53

At last, we need a camera script for a dynamic camera movement.

That’s all. In additional, you can add multiple mobs, plants, mushrooms etc. and also you can add some world items for visualization.

You can download source code here.


Leave a comment

Your email address will not be published. Required fields are marked *

10 thoughts on “2D Mario Clone Game Tutorial (Part 2)