Cocos2dx practice-demo experience in horizontal boxing

Source: Internet
Author: User

[Nagging]

Please move the source code Tutorial: http://blog.csdn.net/iamlazybone/article/details/19612941

Thanks to lazy bones for providing so many demo tutorials, it is really helpful for beginners.

Note: This section only records the experiences of bloggers who have learned about horizontal boxing.


[Game]

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/48/B2/wKiom1QK1knCyfpdAAIvVx2bcvs278.jpg "Title =" 20131217223639500.png" alt = "wkiom1qk1kncyfpdaaivvx2bcvs278.jpg"/>



[Learning experience]


0. encoding steps

(1) Implement sneakyinput

(2) Implement actionsprite

(3) Implement hero, mobility + attack + injury + death

(4) enemy and enemymanager, move, attack, injury, and death

(5) enemy and hero attack each other

(6) Enemy AI, Automatic Walking + automatic attack

(7) Implement game scenario gamescene and tile Map


1. Virtual joystick sneakyinput

Please move: http://shahdza.blog.51cto.com/2410787/1549666


2. mxtiledmap

(1) getmapsize (): number of map tile.

. Width --> width horizontal tile Number of tiles.

. Height --> height: Number of vertical tile tiles.

(2) gettilesize (): the size of each tile, in pixels.

. Width --> width of each tile.

. Height --> height of each tile.

(3) Add a tile map: cctmxtiledmap: Create ("pd_tilemap.tmx ").



3. Move the Background Following the characters

Use ccpclamp.

// Void gamescene: updateviewpointcenter (ccpoint POS) {// only when a person moves to the region where the background is moved, will the background be followed by the person's Pos = ccpclamp (Pos, CCP (mysize. width/2, mysize. height/2), CCP (m_tilemap-> getmapsize (). width * m_tilemap-> gettilesize (). width-mysize. width/2, m_tilemap-> getmapsize (). height * m_tilemap-> gettilesize (). height-mysize. height/2); // set the location of the game scenario, background movement, and the reverse direction of the character movement. This-> setposition (mysize/2-Pos );}//



This article is from the "summer wind" blog, please be sure to keep this source http://shahdza.blog.51cto.com/2410787/1549663

Cocos2dx practice-demo experience in horizontal boxing

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.