[Cocos3.0 Tutorial] Use the Cocos2d-x-3.0 game engine. Write a Tower Defender Game.(Part01)

All the serial:
    Second: http://www.cocos2d-x.org/forums/6/topics/53526
    Third: http://www.cocos2d-x.org/forums/6/topics/53677
    Fourth: http://www.cocos2d-x.org/forums/6/topics/53823
    Fifth: http://www.cocos2d-x.org/forums/6/topics/53962
    Sixth: http://www.cocos2d-x.org/forums/6/topics/54177

Resource: attachment:Resources.zip
The code is released in the sixth tutorial.

    The topic of the game design idea is always making people exciting. In my opinion, an apprentice of the game design or developers independently should take a small classic case to analyze than read one hundred article on the pure theory. It will be more practical. In this series, I am going to show you how to use the Cocos2d-x-3.0 game engine to write a simple Tower Defender Game, Tank defender. When I say Tower defender Game, probably you already know some of these classic games, or you just simply couldn’t recognize them. These pictures will help your memory. Both of them are the Tower defender Game.
        Image Title
        Plant vs. Zombies Magic Defend

    In this issue, I going to show you how to use the Tiled Map editor to build and upload the map. Manage the different layers and the objects. Upload the character. And make it move. Upload your enemy and make them move, too. Also give you the way to defend yourself.

1.Make arrangement:
    Game Engine: Cocos2d-x-3.0rc0: (http://www.cocos2d-x.org/download)
    Tile Map Editor-9.1: (http://sourceforge.net/projects/tiled/files/)
    VS2012: (http://www.visualstudio.com/zh-cn/visual-studio-homepage-vs.aspx)
    First thing first, we need a game engine —Cocos2d-x-3.0, written in C++ and OpenGL ES 1.1/2.0, runs on iOS, Android, BlackBerry, Bada, Marmalade, Windows, Windows Phone, Linux and more.

    Then we still need a edit tool to do the coding and show me the result. (I chose the tool VS2012). (Important! VA plug-in is required. Or you may need a higher version VS, like VS2013. In other word, it needs to support the C++11)

    The Tile Map Editor: the version is 9.1. It can create the map you want.

    The Tile Map picture materials: the pictures that show the effect and create the map.

    The Character/Enemy Sprite: the pictures (use PNG graphics) that represent the character and the enemy.

    The Music: including the background music and the different effect sounds.

        Image Title

    And if everything is done, those music and photographs resources should be put into the file of ‘Resources’.

2.Basic idea
    By learning from the last example, small pokemon, we already know some of the pattern about how they operate (Like the Sprite, the Menu, and the TMXTileMap). Now we are going to make another Tank Defender game. But first, we need to know the basic idea about this game.
    •When enemies come out, they will follow the route which we have predesigned for them. Usually the path will lead them to the destination (the other side of the map).
    •Along the path, we can deploy some tanks to deter and destroy the enemies. When the enemies are in sight, the tank will automatically detect the enemy position and start shooting. And you can build more of these tanks to defend more and more enemies.
    •Hold the line. Until you eliminate the final wave of the enemy, you will win the victory.

3.Make the map
    We now have the sense about how we are going to program the game. Before we can start
coding, we need to do some preparations:
    •First, we definitely need a map to carry out our program.
    •Second, set up multiple waypoints which will lead the enemies.
    •Third, we will create some different types of the enemy.

        Image Title
        Image Title
        Tower defender map

    Use the tile map edit tool to build the map as I shown you above.
        Image Title
Rectangle
        Image Title
    Create a ‘Object’ layer on the upper-right corner. Press the ‘Rectangle’ button to create eight waypoints as I shown you above. And name after those ‘Objects’ like Waypoint00, 01, 02…

        Image Title

To be continue…

Next:http://www.cocos2d-x.org/forums/6/topics/53526


00.png (233.1 KB)


01.png (165.5 KB)


02.png (29.4 KB)


03.png (587.4 KB)


04.png (3.0 KB)


05.png (418.9 KB)


06.png (26.2 KB)


Resources.zip (426.9 KB)


Resources.zip (426.9 KB)

4 Likes

Wow, you’re making another awesome tutorials for newbie, hope you keep doing this:D
Be well!

@nbtthief Thanks~

great tutorial! Thank you for sharing. :smiley:
will wait for next tutorial.

thank you, i like your previous tutorial :smiley:
i’ll try these one too

@Suigintou you are the rockstar of cocos2dx tutorials! daym, . it takes a real game developer to teach game development. thank you sir. less theory, more practical application! :smiley: more plzz more! isometric RTS games plzzzz :smiley:

I can’t see the source code download link…

can you re-up the resource and the picture pls ! This tutorial is so great , it should be archive and re-post in some website that we can see it easier and not limited by the forum edit tool