"Super Marie" 1

Source: Internet
Author: User



Written before the game development document (this game was made in the summer of 13. Lasted 40 days. Learning engine for half a month, the first game has a lot of slots, you crossing light spray.

This document is also written at that time, I also do not bother to patch directly to the post up):

I didn't think about the screen fit when I was writing Super Marie, and when I finally compiled the code onto the Android, I found that the screen fit should be at the very beginning, so I ported the code later.

The original resolution of this game is 480*320. All of the resources are designed at this resolution size, and finally the screen adaptation process only need a line of code, the adaptation of the different screens to solve the problem, but this method is not completely solved, the engine provides this method is flawed, but does not affect the game's execution and experience.



First stage:

Goal: Let Mario show up on a map.

Effects such as the following:

1: Make aTMXformat of the map. The editor used to make the map is open source.Tilemap. This editor is very much2DGame Universal Brick Map editor, editor generated. TMXfiles can beCOCOS2DXin the engineCctmxtiledmap,Cctmxlayer,Cctmxobjectgroupthese three classes are parsed.

Note: About Tilemap There are a lot of editors using the network .

2 : Definition of Mario protagonist in the game, the whole game is in control of Mario Rush, so Mario's definition is crucial.

In the current target only need to let Mario show a picture, do not need animation, a static diagram on the map left and right to pan on it.

Note: In the game of the protagonist class or Monster class, there are generally two ways to inherit, or inherit the engineCcspriteor inherit the engine.Ccnode. Class inside to maintain accsprite*variables can be handled both ways. Just in the game the author uses the latter way, this way, Mario in the face of collision processing performance isCcnodeof the nature. Private variables when switching between Statesccsprite*to be able to do Mario's status switch (just to change a picture display). Play various animations (detailed in this post).

3 : With a map and a Mario, you need a layer to carry them, and the inner engine is a class that has the ability to show. Most of the logic in the game is finished in the layer.

Of course, this self-defined layer Ccgamelayer is also inherited from the engine of the cclayer.

Note: Add the map and Mario to theCcgamelayerin the time. Involves a few knowledge points, one is the anchor point concept, the network has, here is not detailed, after all, this document is descriptive narrative development process, encountered some small knowledge point Baidu understand. Another important one is the local coordinate system, which joins the functionaddChild (Ccnode *)(This function is in the engine. )Ccnodethe member function of the class,Ccnodeis the base class for all the content that can be presented in the game, and here is the base class that holds the content that can be displayed, because the basic class in the engine isCcoject. This is used to refer to the count, which facilitates the memory management of the engine. Do not understand also can Baidu underCOCOS2DXThe principle of memory management based on reference counting for the engine. A lot of similar articles on the web. )

4 : Follow the above procedure. See the effect of a Mario in a location on the map. The first stage is over.

"Super Marie" 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.