[Cocos2d-x development problems-3] cocos2dx Animation introduction

Source: Internet
Author: User

Cocos2d-x in order to reduce the development difficulty, for the realization of animation frame animation scheme. This means that the animation in the Cocos2d-x is a frame animation.

The principle of frame animation is familiar to everyone, that is, multiple images are played cyclically to achieve the animation effect.

A simple animation is implemented as follows:

Player = cc. sprite: create ("image/player.png") player: setPosition (-width/4, 0) local animation = cc. animation: create () animation: animation ("image/player.png") animation: animation ("image/player_2.png") Animation: addSpriteFrameWithFile ("image/player_3.png") animation: setDelayPerUnit (0.1) animation: setLoops (-1) local action = cc. animate: create (animation) player: runAction (action)
This is a piece of lua code. It is not difficult to see from the code that every frame of the animation here is an image. In actual operations, such operations will bring a lot of performance loss, therefore, we usually organize all the images through plist to form a large image, in this way, each animation frame obtains the desired texture from the large image through the coordinate range information recorded in plist, thus improving the animation performance.

[Cocos2d-x development problems-3] cocos2dx Animation introduction

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.