星期一, 10月 31, 2011
星期日, 10月 30, 2011
星期六, 10月 29, 2011
星期日, 10月 23, 2011
星期五, 10月 21, 2011
星期三, 10月 12, 2011
cocos2d Open Source Game projects
Open Source Game projects
Ordered alphabetically
ABC123
- Author: kwigbo
- Features: Mixture of cocos2d and UIKit
- Homepage: http://kwigbo.tumblr.com/abc123
- How to use: Open project in xcode - Build and Go
Artifice
- Author: kwigbo
- Features
- Cocos2d / UIKit mixture
- OpenFeint integration
- Push Notifications via Urban Airship
- Online turn based multiplayer
- App Engine application backend (Source Included)
Climbers
- Author: haqu
- Features
- ipad
- zwoptex spritesheets
- smooth vertical scrolling
- particle system
- verlet rope
- music and sound
- actions
- menu
- Homepage: https://github.com/haqu/climbers
- License: Open Source (MIT)
DeBlock
- Author: Lhunath
- Features:
- Cocos2D-iPhone
- TouchJSON
- Music/Audio
- Homepage: http://deblock.lhunath.com
- How to use: See “Versions” tab on game homepage
- License: Open Source (JRL)
Gorillas
- Author: Lhunath
- Features:
- cocos2d
- music/audio
- Homepage: http://gorillas.lhunath.com
- How to use: Follow instructions from game homepage
- License: Open Source (JRL)
Grabbed
- Author: orta
- Features:
- chipmunk physics
- chipmunk collisions
- Homepage: http://ortatherox.com/grabbed/
- How to use: load Skeleton.xcodeproj then Build & Go
- License: Open Source
Pusher
- Author: kwigbo
- Features: This is a simple game shell that uses Tiled tile map editor for creating a scrolling tile based map.
- TileMapAtlas
- How to use: Open project in xcode - Build and Go
Thrown
- Author: orta
- Features:
- chipmunk physics
- chipmunk collisions
- Homepage: http://ortatherox.com/thrown/
- How to use: load Skeleton.xcodeproj then Build & Go
- License: Open Source
Tweejump
- Author: haqu
- Features:
- vertical scrolling
- BitmapFontAtlas
- Homepage: https://github.com/haqu/tweejump
- License: Open Source (MIT)
Commercial Game projects
Sapus Tongue
- Author: Sapus Media
- Features
- iAd / adMob
- Sprite and Spritesheet
- Parallax
- Menu
- Chipmunk collisions
- Sound
- Transitions
- cocosLive
- Homepage: http://www.sapusmedia.com/sources
- License: Commercial
cocos2d Basic Concepts
cocos2d Basic Concepts
There are some basic concepts introduced in this library that you will need to know when developing a cocos2d application:
Scenes
A scene (implemented with the CCScene
object) is more or less an independent piece of the app workflow. Some people may call them “screens” or “stages”. Your app can have many scenes, but only one of them is active at a given time.
For example, you could have a game with the following scenes: Intro, Menu, Level 1, Cutscene 1, Level 2, Winning cutscene, losing cutscene, High scores screen.
You can define every one of these scenes more or less as separate apps; there is a bit of glue between them containing the logic for connecting scenes (the intro goes to the menu when interrupted or finishing, Level 1 can lead you to the cutscene 1 if finished or to the losing cutscene if you lose, etc.).
A cocos2d CCScene
is composed of one or more layers (implemented with the CCLayer
object), all of them piled up. Layers give the scene an appearance and behavior; the normal use case is to just make instances of Scene with the layers that you want.
There is also a family of CCScene
classes called transitions (implemented with the CCTransitionScene
object) which allow you to make transitions between two scenes (fade out/in, slide from a side, etc).
Since scenes are subclasses of CCNode
, they can be transformed manually or by using actions. See Actions for more detail about actions.
Director
The CCDirector
is the component which takes care of going back and forth between scenes.
The CCDirector
is a shared (singleton) object. It knows which scene is currently active, and it handles a stack of scenes to allow things like “scene calls” (pausing a Scene and putting it on hold while another enters, and then returning to the original). The CCDirector
is the one who will actually change the CCScene
, after a CCLayer
has asked for push, replacement or end of the current scene.
The CCDirector
is also responsible for initializing OpenGL ES.
Layers
A CCLayer
has a size of the whole drawable area, and knows how to draw itself. It can be semi transparent (having holes and/or partial transparency in some/all places), allowing to see other layers behind it. Layers are the ones defining appearance and behavior, so most of your programming time will be spent coding CCLayer
subclasses that do what you need.
The CCLayer
is where you define event handlers. Events are propagated to layers (from front to back) until some layer catches the event and accepts it.
Although some serious apps will require you to define custom CCLayer
classes, cocos2d provides a library of useful predefined layers (a simple menu layer: CCMenu
, a color layer: CCColorLayer
, a multiplexor between other layers: CCMultiplexLayer
, and more ).
Layers can contain CCSprite
objects, CCLabel
objects and even other CCLayer
objects as children.
Since layers are subclass of CCNode
, they can be transformed manually or by using actions. See Actions for more detail about actions.
Sprites
A cocos2d' sprite is like any other computer sprite. It is a 2D image that can be moved, rotated, scaled, animated, etc.
Sprites (implemented using the CCSprite
class) can have other sprites as children. When a parent is transformed, all its children are transformed as well.
Since sprites are subclass of CCNode
, they can be transformed manually or by using actions. See Actions for more detail about actions.