Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TheDamArmada/Flash2Cocos2D
Library to import animations made in Flash to Cocos2D
https://github.com/TheDamArmada/Flash2Cocos2D
Last synced: 3 months ago
JSON representation
Library to import animations made in Flash to Cocos2D
- Host: GitHub
- URL: https://github.com/TheDamArmada/Flash2Cocos2D
- Owner: TheDamArmada
- Created: 2012-03-15T16:51:11.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2019-05-21T19:38:37.000Z (over 5 years ago)
- Last Synced: 2024-06-23T19:36:39.199Z (5 months ago)
- Language: ActionScript
- Homepage:
- Size: 59.2 MB
- Stars: 91
- Watchers: 15
- Forks: 31
- Open Issues: 3
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
- awesome-actionscript-sorted - Flash2Cocos2D - Library to import animations made in Flash to Cocos2D (Frameworks / Animation Framework)
- awesome - Flash2Cocos2D - Library to import animations made in Flash to Cocos2D (etc)
- awesome - Flash2Cocos2D - Library to import animations made in Flash to Cocos2D (etc)
README
FlashToCocos2D
===============This tool provides a fast way of reusing animations made in Flash CS in Cocos2D projects.
A minimaly tweaked version of the amazing exporter by [Grapefrukt](https://github.com/grapefrukt/grapefrukt-export) provides a way to export all the animation information (position, rotation, scale) of a Flash made character to xml.
The FlashToCocos iOS library reads those xml files and recreates the characters in Cocos2D.Basic workflow:
FLASH SIDE:
- create your character in Flash
- create as many animations a needed
- every animation has to have a keyframe labeled with an unique name. IE: "*dancing*", "*running*"...
- to launch custom events during an animation, you can use keyframes labels prefixed with @. IE: "*@launchSound*"
- select 'Export for Actionscript' for your character MovieClip
- add the Grapefukrt exporting code on the first frame:```actionscript
import com.grapefrukt.exporter.simple.SimpleExport;
import com.grapefrukt.exporter.extractors.*;
// change robot for whatever name you want to use
var export:SimpleExport = new SimpleExport(this, "robot");
// change RobotCharacterMc for whatever name you MovieClip is in the library
export.textures.add(TextureExtractor.extract(new RobotCharacterMc));
AnimationExtractor.extract(export.animations, new RobotCharacterMc);
export.export();
```- publish
- on the top left corner click on "*click to output*"
- save the zip file
- unzip the zip fileXCODE:
- start a Cocos2D project
- enabled ARC following this [instructions](http://www.tinytimgames.com/2011/07/22/cocos2d-and-arc/)
- add the FlashToCocos Library
- add the [TBXML Library](http://tbxml.co.uk/)
- add the results of unzipping the file created from FlashFTCCharacter Class
Overview
FTCharacter is the main class to be used. It extends CCLayer and it's the responsible to load the XML files and textures.
There are still a lot of methods exposed that shouldn't be. Hopefully we'll be able to clear the code a little bit in short time.Class Methods
```-(FTCharacter) characterFromXMLFile:(NSString *)xmlFileName```
Reads and XML, loads texture and returns a FTCCharacter.
IE:FTCharacter *robot = [FTCharacter characterFromXMLFile:@"robot"]
Instance Methods
-(void) playAnimation:(NSString *)animation loop:(BOOL)loops wait:(BOOL)waits
Starts playing the specified **animation**. It will **loop** it if specified.
The wait parameter indicates if this animation should **wait** for the previous one to finish before start playing.
-(void) stopAnimation
Stops the current animation being played.
-(void) pauseAnimation
Pauses the current animation.
-(void) resumeAnimation
Resumes the current paused animation.
-(void) playFrame:(int)_frameIndex fromAnimation:(NSString *)_animationId
Sets the character to the specified **frame** for the specified **animation**.