概述
cocos2d for iPhone
A 2d game engine for iPhone / iPad that's fast, easy to use,
free, and community supported
Blog Store Forum Games Download Documentation About Archives
Register ?Older Home Loading Newer? Less More Trim Untrim ?Older
The cocos2d family keeps growing Published by riq on December 2,
2010 in cocos2d and family. 8 Comments
The cocos2d family keeps growing and growing and growing ...
The new members of the family are:
cocos2d-x,mini
dv camcorder, in C + +, multiplatform cocos2d-android-1, in
Java, for Android cocos2d-javascript, in Javascript, for Web
cocos2d-x
Homepage: http://www.cocos2d-x.org Git repository: https: / /
github.com/cocos2d/cocos2d-x Platforms: iOS, uPhone, Win32. Coming
soon: Bada, Android Language: C + + Based on cocos2d-iphone v0.99.4
cocos2d-android-1
Homepage: http://code.google.com/p/cocos2d-android-1/ Git
repository: https: / / github.com/ZhouWeikuan/cocos2d Platforms:
Android Language: Java Based on cocos2d-iphone v0.99.4 This is the
2nd port of cocos2d for Android / Java (See
Homepage / git repository: https: / /
github.com/RyanWilliams/cocos2d-javascript Platforms: Web (html5 /
javascript) Language: Javascript Based on cocos2d-iphone: v0.99.5
Related links:
cocos2d v0.99.5 supports Mac as a target platform The cocos2d
family (previous ports of cocos2d) cocos2d v0.99.5-rc1 released
Published by riq on November 16, 2010 in cocos2d. 12 Comments
I'm happy to announce that v0.99.5-rc1 is available for
download:
cocos2d-iphone-0.99.5-rc1.tar.gz
Highlights
Performance improvements in: PVR Texture: Added support for zipped
textures (. gz /. ccz). Fast loading times with small file size PVR
Texture: Faster way to transfer texture from disk to memory
FontLabel: Improved loading time in iOS 4.x CCLabelTTF: (optional)
faster rendering time at the cost of consuming more memory on ARMv7
Improved Mac support Improved RetinaDisplay support and many many
bug fixes
Release Notes: Release Notes v0.99.5-rc1
Full Changelog: v0.99.5-rc1 ChangeLog
What's next:
v0.99.5? (final) should be ready in less than 1 month Unless there
is an ugly bug within the API,blue
bridesmaid dress, the v0.99.5 API will be equal to the v1.0 API
I would appreciate if you can test this version in your game and
report any issue that might appear. Thanks. < / p> Verlet
rope Published by patrickC on October 29, 2010 in box2d and
cocos2d. 9 Comments Introduction
In this brief article we'll be taking a look at an efficient way
of creating ropes in our cocos2d games that use box2d, starting
from a cocos2s + box2d template project.
We will be using box2d's latest addition, the b2RopeJoint to
constrict two bodies with a rope joint (a maximum distance joint,
one might also call it), so as always big thanks to Erin Catto for
all his hard work on box2d.
We will also be using a small set of classes I wrote, VRope, that
use Verlet integration to calculate the points of the rope, using a
CCSpriteBatchNode to visually draw the rope in our game.
Click for video
It's worth mentioning that using Box2D isn't strictly necessary,
you could still use the VRope class to draw a rope between two
given points in other scenarios (for example using Chipmunk, your
own physics system, or simply updating the two points manually) and
have it react under gravity. With that in mind, the class also has
some helper methods to use it with CGPoints only.
(somethingWithPoints methods)
Setting up the project
First things first, make sure you have the latest version of
Cocos2D and create a new project with the / /
code.google.com/p/box2d/source/checkout
To update Box2D in your current project:
From within XCode, delete the Box2D folder group from the From
Finder, go to your project's folder and delete the Box2D folder
Copy over the latest version of Box2D back into your project's
folder (make sure you only copy the most deep rooted Back to
XCode, Project -> Add to Project,sport watches,
select the Box2D folder, make sure create groups (not folder
reference) is selected, Add
This should give you a working Cocos2D project, updated with the
latest Box2D source that has the b2RopeJoint ready to use.
If you're not running the latest version of cocos2d (0.99.5-rc0)
but still want to use VRope, you'll need to rename
CCSpriteBatchNode back to CCSpriteSheet, the rest should work as
is.
Using b2RopeJoint
Using the new b2RopeJoint is very easy, it's similar to the
b2DistanceJoint, but unlike other joints it doesn't have an
Initialize method.
/ / define rope joint, params: two b2bodies, two local anchor
points, length of rope b2RopeJointDef jd; jd.bodyA = body1; / /
define bodies jd.bodyB = body2; jd.localAnchorA = b2Vec2 (0,0); / /
define anchors jd.localAnchorB = b2Vec2 (0,0); jd.maxLength =
(body2-> GetPosition () - body1-> GetPosition ()). Length ();
/ / define max length of joint = current distance between bodies
world-> CreateJoint (& jd); / / create joint Verlet
Integration
Now that we know how to constrict two bodies with a rope joint,
we need to find an elegant and efficient way of drawing the rope,
drum roll,fence net
body stocking, enter screen right: Verlet integration.
The implementation you'll find below is based on a very informative
tutorial by YoAmbulante.com (for Flash) that allowed even a simple
minded person such as myself to grasp the basic concepts of Verlet
integration, so big thanks to the author of that tutorial .
The and then each of these dots are associated (grouped) by
pairs that try to keep same distance between each other as they
were when the program started.
Based on this, I decided to design 3 classes (rather than use
structs, each to his own)
VPoint - store a point's current and previous position VStick -
connect two VPoints and keep them at constant distance VRope -
keeps arrays of VPoints and VSticks, update logic,
CCSpriteBatchNode to render rope
Rather than go trough all the source code,cheap
wireless mouse, we'll be taking a look at how to implement it
into our test project.
In the main header file (VRope.h) you can find instructions on
usage, and the code is slightly commented and easy to understand,
so more advanced users could easily adapt it further to their own
needs.
Using VRope
Download the VRope class here, unzip, copy it over to your
project's folder and add it to your project from XCode.
First,ir
remote extender, you'll want to import VRope.h into
HelloWorldScene.h
# import / p>
b2Body * anchorBody; / / reference to anchor body
CCSpriteBatchNode * ropeSpriteSheet; / / sprite sheet for rope
segment NSMutableArray * vRopes; / / array to hold rope
references
Now we'll add some code to our main class,
HelloWorldScene.mm.
In the init method of HelloWorldScene, remove the creation of the
groundBody and all it's shapes and in it's place add:
/ / + + + Add anchor body b2BodyDef anchorBodyDef;
anchorBodyDef.position.Set (screenSize.width/PTM_RATIO/2,watch cell
phones, screenSize.height / PTM_RATIO * 0.7f); / / center body
on screen anchorBody = world-> CreateBody (& anchorBodyDef);
/ / + + + Add rope spritesheet to layer ropeSpriteSheet =
[CCSpriteBatchNode batchNodeWithFile: @ [Self addChild:
ropeSpriteSheet]; / / + + + Init array that will hold references to
all our ropes vRopes = [[NSMutableArray alloc] init];
In the addNewSpriteWithCoords method, add these lines at the
bottom:
/ / + + + Create box2d joint b2RopeJointDef jd; jd.bodyA =
anchorBody; / / define bodies jd.bodyB = body; jd.localAnchorA =
b2Vec2 (0,0); / / define anchors jd.localAnchorB = b2Vec2 (0,0);
jd.maxLength = (body-> GetPosition () - anchorBody->
GetPosition ()). Length (); / / define max length of joint =
current distance between bodies world-> CreateJoint (& jd);
/ / create joint / / + + + Create VRope VRope * newRope = [[VRope
alloc] init: anchorBody body2: body spriteSheet: ropeSpriteSheet];
[VRopes addObject: newRope];
In the draw method, add these lines at the bottom:
/ / + + + Update rope sprites for (uint i = 0; i
count]; i + +) {[[vRopes objectAtIndex: i] updateSprites]; }
In the tick method, add these lines at the bottom:
/ / + + + Update rope physics for (uint i = 0; i
count]; i + +) {[[vRopes objectAtIndex: i] update: dt]; }
Copy rope.png to your Resources folder and add it to your
project (rope.png can be found in the archive of the test project
below)
Build & Run! If all went well, you should have the same result
as the video at the beginning of the article.
As I mentioned at the beginning, the code is very simple and
fast (no thanks to me), so adapting it to other uses should be
pretty simple.
Downloads
VRope class
Cocos2D VRope Test Project
About the author
I've been using cocos2d for over a year and a half and I'ma
regular on the forums, so feel free to ask questions in the thread
about VRope.
The VRope class was originally created to be used in Paper Bridge,
a physics based bridge construction puzzle game developed by Clever
Hamster Games (aka: me).
cocos2d v0.99.5-rc0 released - Improved Retina Display support
Published by riq on October 27, 2010 in cocos2d. 3 Comments
cocos2d v0.99.5-rc0 just has been released.
Download:? cocos2d-iphone-0.99.5-rc0.tar.gz
Release Notes:? Release Notes v0.99.5-rc0
API Reference:? v0.99.5-rc0 API Reference
Highlights:
Improved Retina Display support Improved templates
and many bug fixes and little improvements.
Full Changelog:? CHANGELOG
How to create Retina Display games (updated for
v0.99.5-rc0):
Programming Guide: Creating Retina Display games Get ready for the
Mac App Store Published by riq on October 20, 2010 in cocos2d. 5
Comments
Apple announced today that in 90 days the Mac App Store will be
ready!
The Mac App Store will be similar to the App Store, but instead
of 0680d774828d967eaeb794899db913ab iOS applications, it will distribute
Mac applications.
This is big news for cocos2d users, since cocos2d already
supports Mac!!
The guidelines and other requirements for the Mac App Store are
online:
Mac App Store Review Guidelines App Store Resource Center
So, download the latest cocos2d version, and start porting your
cocos2d game for Mac!
More info regarding cocos2d for Mac: cocos2d includes Mac
support
Trainyard: Another cocos2d successful story Published by riq on
October 15, 2010 in cocos2d and games. 11 Comments
Trainyard is a very polished, well designed , orignal game.
As of today, the game is:
2nd Top Paid App in US 2nd Top Free App in US 3rd Top Grossing App
in US
What is very interesting, is that this game was developed by
just 1 person (Matt Rix) with a lot of hard work, hard work, hard
work and conviction.? I suggest reading the story behind this game.
It is very inspiring!
Trainyard: The story so far
It contains details about the whole lifecycle of a game:
Game design Tools Marketing
and more.
Haven't you tried Trainyard yet?
Trainyard $ 0.99 (It's on SALE now!) Trainyard Express $ Free
cocos2d v0.99.5-beta3 released. API uses Points instead of Pixels
Published by riq on September 23, 2010 in cocos2d. 3 Comments
cocos2d v0.99.5-beta3 just has been released.
Download: cocos2d-iphone-0.99.5-beta3.tar.gz
Release Notes: Release Notes v0.99.5-beta3
API Reference: v0.99.5-beta3 API Reference
Highlights:
The cocos2d API uses Points instead of Pixels (Retina Display
friendly)
Full Changelog: CHANGELOG
Creating Retina Display games:
Programming Guide: Creating Retina Display games cocos2d
v0.99.5-beta2 released. Added Mac support. Published by riq on
September 1, 2010 in cocos2d. 5 Comments
p >
cocos2d v0.99.5-beta2 is available for download:
cocos2d-iphone-0.99.5-beta2.tar.gz
Release Notes:
v0.99.5-beta2 Release Notes
API Reference:
v0.99.5-beta2 API Reference
Full ChangeLog:
CHANGELOG
Highlights:
Added support for Mac. Your cocos2d / CocosDenshion game can be
ported to Mac with minimal changes
Regarding the Mac Port
cocos2d for Mac works as excepted with the following
exceptions:
CCParticleSystemPoint is not supported. Use CCParticleSystemQuad
instead. CCTexture2d / CCLabelTTF don't support FontLabel
CCRenderTexture doesn't support It doesn't work with garbage
collection yet It doesn't support fullscreen mode yet It doesn't
support touches yet.
To port your cocos2d / CocosDenshion game to Mac, you have
to:
Modify the way you initialize / create the CCDirector and the
OpenGL view. Replace the touches and / or accelerometer events with
Mouse and / or keyboard events The rest is the same.
The cocos2d-mac.xcodeproj includes several tests that show how
to support mouse events and how to initialize the CCDirector /
OpenGL view.
The game Sapus Tongue was already ported to Mac. You can find
some details about how it was ported in this thread.
Are you porting your game to Mac? Let use know when the game is
finished!
New cocos2d games page: Admin section Published by itlgames on
August 18, 2010 in cocos2d. 9 Comments
Hi,cell
jammers, we have added an admin secion for the cocos2d games
page, so if you have added any of your games there, and you did
enter your forum username on the add form, then you can manage them
here:
http://www.cocos2d-iphone.org/games/cms
Just use your username / password from the forum, if you have
one. Once logged, see the main navigation under the banner, our
cocos2d categories.
Once editing a game you will see the iTunes info, with a link to
refresh (may take some time) and if you scroll down the page, you
will see the cocos2d categories and the cocos2d version
used,zhu
zhu pet hamsters, please try to fill all them. If you find your
game doesn't belong to any of our categories,mobile
phone chargers, please let us know.
Also note the subnavigation on the left, / p>
And if you didn't enter your username when you created the game,
no worries, you can go again to:
http://www.cocos2d-iphone.org/games/add/
And fill in all information, including your forum username, and
this will update the database and you will be able to use the
CMS.
Please have a look and shout if any problems.
Autorotation in v0.99.5 templates Published by riq on August 4,
2010 in cocos2d. 8 Comments
In order to be iPad compliant, v0.99.5 will include updated
templates that support autorotation.
Basically the new templates will have 3 new files:
GameConfig.h RootViewController.m (and. H)
The? RootViewController .* files contain the code to handle the
autorotation.
And in GameConfig.h you will be able to configure how to handle
the autorotation:
No autorotation Autorotation handled by cocos2d Autorotation
handled by UIViewController (default)
No Autorotation: It means just that. The EAGLView won't be
autorotated
Autorotation by cocos2d: The EAGLView will be is not rotated).
[-]: If you are going to add UIKit objects to the EAGLView, then
you will need to rotate them manually.
Autorotation by UIViewController: The EAGLView will be rotated
by the UIViewController
[-]: The UIViewController will rotate the EAGLView and it is bit
slower than using a single glRotate () command. [+]: There is no
need to rotate any UIKit object contained by the EAGLView.
If you want to understand how to implement autorotation
manually, or if you are interested in understanding the technical
details,babydoll
dress, I suggest reading this article: < / p>
Autorotation in cocos2d
And if you want to try the new templates now, then you should
download the latest code from the
Update: Bill Hollings wrote an interesting article regarding
autorotation where he describes another approach. Includes sample
code: cocos2d an UIViewControllers
?Older Search for: cocos2d games of the day Rocket Boy 2D Mathieu
Roy $ 0.99 17th July 2010 iKout Omar Alhaddad $ 2.99 11th May 2010
PowerDown Dave Allanson $ 0.99 24th August 2010 Recent CommentsTodd
Fincannon on Integrating cocos2d API reference into XCodeTodd
Fincannon on Integrating cocos2d API reference into XCoderiq on The
cocos2d family keeps growingStuart Carnie on The cocos2d family
keeps growingErik on The cocos2d family keeps growingForum Last 10
Discussionsapp stalling after boot, 0.99.5-rc0/sdk4.1/iOS 4.x
(5)
Last Post By: Dragyn
Inside: cocos2d support (graphics engine) ccTouchCancelled not
called or should it ? (7)
Last Post By: Dragyn
Inside: Programming - Everything elseCocos2d with C + + files?
(with CAStreamBasicDescription) (6)
Last Post By: pascal2000
Inside: cocos2d support (graphics engine ) [Book] Three Little Pigs
(18)
Last Post By: airic081
Inside: cocos2d gamesAdWhirl iAd problem (3)
Last Post By: finder39
Inside: high score, social and ads networksFuzzy graphics on
iPhone 4 (8)
Last Post By: itlgames
Inside: cocos2d support (graphics engine) Non-circular Ripple
effect: possible? (1)
Last Post By: ZeroDivide
Inside: cocos2d support (graphics engine) Why does repeating a
64x64 texture slow down more than using a 768x2048? (5)
Last Post By: Blue Ether
Inside: cocos2d support (graphics engine) Tiki Totems 2 - out Dec 6
th,usb
to serial cable! (28)
Last Post By: Holmiz
Inside: cocos2d games [GAME] UniTris - awesome puzzle game!!!
(17)
Last Post By: Holmiz
Inside: cocos2d games Meta Register Log in Entries RSS Comments RSS
WordPress.org
Powered by WordPress and K2
cocos2d banner and logos by Michael Heald from Fully
Illustrated
Entries Feed and Comments Feed
63 queries. 3.283 seconds.
相关的主题文章:
最后
以上就是炙热棒球为你收集整理的zhouweikuan cocos2d android-1,cocos2d for iPhone的全部内容,希望文章能够帮你解决zhouweikuan cocos2d android-1,cocos2d for iPhone所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复