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
- // Dialog // usage of the alert Control
- Int idx = CCRANDOM_0_1 () * 600/100;
- UIAlertView * dialog = [[UIAlertView alloc] init];
- [Dialog setDelegate: self];
- [Dialog setTitle: [NSString stringWithFormat: @ "% d", idx];
- [Dialog setMessage: @ "Game paused"];
- [Dialog addButtonWithTitle: @ "Resume"];
- [Dialog show];
- [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!