how to build your own site

Creating a 2D game "Mario" in Coppercube

Most of the coppercube game developers and newbies find
it difficult to create 2D games using this 3D
engine. In this tutorial we are going to create a  clone of the Classic Mario game level without programming a single line.

Step 1

Getting the resources

The most important and difficult part of any game development is getting the desired resources for the game idea, you will need texutures, sprites, soundFX, background music and lot more. Thats why i choose MARIO as base for this tutorial. You can get the resources easily on the net. Just google mario game rsources and you will be provided with bunch of resources. To get started faster i have listed my favourite site for getting the game resources, You can also download the resources directly by going to the google drive link provided below.
3D Models Resources
Textures Resources
Sprites Resources
Sound Resources
Direct link to download resources for this Tutorial
https://drive.google.com/file/d/1I3CcmrEQciKVXAXPqmX8idkVtsOQx0so/view?usp=sharing




Step 1

Step 2

Importing The Resources Into The Engine

While working with a 3D game, I spend lot of hours deciding what I want to import first  NPC'S, Main Character or  Backgrounds etc. But as we are working on 2D game, what we need is to import all the textures or png resources. we don't recquire to import anything else.

Step 2

Step 3

Applying Textures And Creating 2D Assets

We have our textures imported now we have to convert them into real asset to use in our 2D game.
First of all we need to know the resolution of the texture of the item we are going to add in our 2D game. The enemy Goomba for example has a resolution of 16X16. 

Step 3

So what we gonna do is to create a plane mesh of height  16 and with a width 16 too and then we have to apply the texture for enemy Goomba to the planemesh. Rename the planemesh to Goomba.
Do the same thing for other characters or backgrounds. Select the texture, get the resolution and create planemesh according to that resolution, apply the texture and rename it.

Do not create more than one instance of an object, for example there are total of 16 Goomba's in Mario World 1-1 but we need to create only one Goomba.

Step 3.2

Step 4

Placing The Objects

Once we are done with converting textures into meshes. we are going to place the background objects to their position. we are not going to place game objects which affects the gameplay. we are going to place static object like clouds, floor, plants and stone walls, which have nothing to do with the gameplay. 

Step 4

Step 5

Scaling and Rotating

To place the objects into the right positions we are going to create fake (Dummy) asset.
To create a dummy of the level all you have to do is to create a planemesh of the same resolution of the provided texture for dummy. and position it to (0,0,0) now select the object you want to place into the game. For example select the cloud and drag it to the same position as you see on the dummy world. Do the same thing with other background objects plants,bushes and stones. 

Step 5

Step 6

Animating Game Objects

We have placed the background objects, we are ready with our enemies, character, bricks and item meshes, now we need to animate our meshes.
To animate our meshes we are going to use an inbuilt Coppercube behavior ANIMATE A TEXTURE.
Select the enemy Goomba mesh and click on add behavior choose effect behavior and select Animate A Texture. Now select both of the enemy texture Goomba walk1 and Goomba_walk2 for the texture in the behavior setting. you will instantly see your enemy animation. Do the same for other objects,except the Player object as he is going to have multiple animations.

Step 6

Step 7

Adding Collision And Behaviors

We have our assets ready with textures and animations now all we need is assigning Collision and Behaviors to them. Let's create a cube mesh of size 16 (size is according to the resolution), copy the position of the enemy Goomba and paste that position to cubemesh and make the cube mesh child node of that Goomba. change the material of cubemesh to Transparent Add and assign a black texture to it. rename the cubemesh to Collision_enemy.

Step 7

Now add a planemesh of 16X16 and adjust it position to match the position of Goomba. Assign the same material settings as Cubemesh to it. and rename it to Collision_death. Position the planemesh such that it will be on top of the cubemesh. and make it child node of the Goomba.

Step 7.2

Now add a new behavior to the Collision_death "On Proximity Do Something".
Test Area = Box
Size = 16,16,16
Near to what = a scenenode
Near to Which Scenenode = Player
And in Action to do add a clone behavior of the death of Goomba node relative to the original goomba.
add play sound action and play the kick sound.
add a change variable behavior and add 100 value to that variable.(create any variable you like ,e.g. Score)
add scripted behavior do something later.
and Choose 100ms add action to execute delete scenenode Goomba.

Step 7.3

This is how you can add behaviors for and collision for other objects too.

Step 7.4

Step 8

Player Mesh

Now we are ready with behaviors of our npc's. Its time to have our player in the game.
First of all create a cubemesh of size same as the resolution of player.
e.g. Small mario has resolution of 16x16. now we will create a cube mesh of 16 size and rename it to "Player". and will assign a tranparent add black material to it.
now create Four diffrent meshes for our player as we have done in step 3.
each of the mesh will have diffrent animation.
one will have run animation, second will have jump, third will have idle and fourth will be going to death animation.
make all the four meshes children of the player cubemesh.

Step 5

Step 9

Adding Behaviours To Player

We will add a collide when moved behavior to our mesh and adjust the sphere according to the player mesh.
And we will add simple 2D jump and run behavior to make the character move and we will add different key pressed behaviours to switch between animations of the player. e.g. if a keypressed "SPACE" then hide all the other children nodes and show only jump node of the playermesh.
I have also edited the behavior jump and run so that the player won't move if up and down arrow keys are pressed.

Step 5

Step 10

Cloning and Placing Objects

Earlier we have placed backgrounds objects like clouds and plants now we are going to place our enemies, bricks and item blocks. we will do same as we have done before we will use the dummy mesh to position objects. but we will need to clone objects first so clone all the instances of an object you want in your game.
e.g. clone Enemy Goomba 16 times. and place them according to the dummy. Sameway place all other objects. Also adjust their Behaviors.

Step 5

Step 11

Ai and Movement of Enemies

For the movement of the enemies we will be going to use change position of a scnenode behavior which will be relative to a scenenode. most of the time we will make them relative to the pipes. Also we need to add that behavior before starting the scene.

Step 11

Step 12

Adding Camera


Add a 3rd person camera to your scene and choose player as object to follow. change the target height if you wanted to and assign follow from behind fixed rotation. You can also add a clonemesh of player without collision and jump set to zero then set it as target for camera to do correct camera tracking.

Step 5

Step 13

Conclusion

Hurrah!! we just completed cloning the Mario game. In this tutorial I have skipped a lot of details. but i have tried to cover all the major parts, and have also provided the link to a ccb file which may clear more doubts.
CCB file doesn't contain the complete level. it covers all the major part. e.g. killing enemy, picking up coins, etc.

TroubleShooting

 If you have any issue and problems regarding this tutorial, just ask me it in the Comments section.

Links

CCB Template and Resources

Here is the url to download CCB template of this tutorial and resources used in this clone.
Resources
CCB Template

FACEBOOK COMMENTS WILL BE SHOWN ONLY WHEN YOUR SITE IS ONLINE

SHARE THIS PAGE!

Address

Jaipur, RJ 302016

Contacts

Contact us
beingneophyte@gmail.com