Notes about Cocos2d in IOS game development

Source: Internet
Author: User

IOS gamesAboutCocos2dLearning notes are the content of this article, mainly fromCocos2dAlert usage,Cocos2dSelf-built animation,Cocos2d. Let's take a look at the details.

Usage of Alert in Cocos2d

 
 
  1. // Dialog // usage of the alert Control
  2. Int idx = CCRANDOM_0_1 () * 600/100;
  3. UIAlertView * dialog = [[UIAlertView alloc] init];
  4. [Dialog setDelegate: self];
  5. [Dialog setTitle: [NSString stringWithFormat: @ "% d", idx];
  6. [Dialog setMessage: @ "Game paused"];
  7. [Dialog addButtonWithTitle: @ "Resume"];
  8. [Dialog show];
  9. [Dialog release];

Cocos2d self-built Animation

First, I will introduce a blog article: cocos2d HOWTO series: How to Create FramesAnimation. I found this article when I was a beginner at cocos2d, but some of the content in it is outdated, so I wrote anotherAnimation.

Let me talk about the key points:

ProductionAnimationA series of animated images, such as png files, are required ). To create an animated png file, Use Adobe Flash to convert fla to png as described above. You can also use some free software to convert swf to png. Here are some software: SpriteSheetCreator, SWFSheet, and SWFToPNG. You can search online.

After a png animated series is generated, it must be integrated into a png sprite sheet ). The software used here is Zwoptex. Use this software to generate a png and a plist. plist records the x, y, height, and width data of each sprite. Cocos2d supports plist format generated by Zwoptex. Unfortunately, Zwoptex has recently started charging fees. A previous version is provided here, which can also meet our requirements. Download the Zwoptex-0.4b10.app.

My program is to play an animation of a fan, and press it to start the animation, and then press it to stop. I modified the HelloWorld program and added an Object class for animation processing. The only thing to note is that the path used in addSpriteFramesWithFile is the relative path. At first, I encountered a problem because I used the absolute path.

CSV files in cocos2d

Recently I used csv files in some cocos2d games. I checked them and shared them with you. They are very short, simple, and easy to use.

CSV file Introduction

Introduction
The full name of CSV is Comma Separated values, which is a plain text used to store data.

File Format, usually used for workbooks or database software.

Rules

Starting with 0, it is not left blank, in the unit of action.
1. The column name can be included or not included, and the column name is the first row of the file.
Two rows of data are empty.
3. Use a half-width symbol as a separator. If the column is empty, its existence must be indicated.
If four columns of content exist, use "" to include them.
If the five columns contain "", use "to include them.
6. quotation marks are used to read and write files.
The internal code format is not limited. It can be ASCII, Unicode, or other.

Summary:IOS gamesAboutCocos2dThe content of the study notes has been introduced. I hope this article will help you!

Related Article

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.