Transitions for Layers/Children?

Forums Programming cocos2d support (graphics engine) Transitions for Layers/Children?

This topic contains 5 replies, has 2 voices, and was last updated by  robodude666 3 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
Author Posts
Author Posts
June 19, 2010 at 10:58 pm #222563

robodude666
@robodude666

Hey guys,

Normally you would set a running scene from the app delegate. Then, you might replace the scene with a new scene with some sort of transition, etc. Maybe you might push/pop the scene if you’re doing menu structure or something.

I was thinking.. Is there any way to apply a transition to a new layer that’s being added as a child? For example, create one scene that contains multiple layer and hide/show layers as needed using transitions, etc.

-robodude666

June 19, 2010 at 11:18 pm #287302

ShempLock
@shemplock

Yes, use Core Animation and UIKit.

You should watch the following from the WWDC2010 videos: “Game Design and Development for iPhone OS” parts 1 and 2. The go over, in very great detail, exactly what you are talking about. They use the game named Quest they did for a demo.

I highly suggest everyone watch those 2 videos as they talk in detail about Game UI, and mixing Core Animation with OpenGL.

June 20, 2010 at 3:49 am #287303

robodude666
@robodude666

Watched ‘em both and they were indeed fantastic. Got some great ideas for other things though this issue wasn’t really solved. Apple doesn’t really talk about Cocos2D at WWDC.

-robodude666

EDIT: On second though, it gave a few other ideas that I’ll try out. ~Cheers!

June 20, 2010 at 4:33 am #287304

ShempLock
@shemplock

Yeah those videos are awesome (not just those two). Some very VERY cool stuff coming our way if you want to target iOS 4 :) iAd, the Game Center, no longer having to support OpenGL ES 1.1 (assuming you only want to run on iPad, 3GS and iPod 3rd gen). Cool stuff

June 20, 2010 at 4:42 am #287305

ShempLock
@shemplock

Check out “Core Animation in Paractice” parts 1 and 2. They show more detail of OpenGL ES layers being animated with regular UIKit objects (which are of course layers). Normally you do not mix UIKit/CLayers with OpenGL, but if its for a menu, options, etc why not? The performance hit don’t matter during certain game steps.

You would never use UIKit objects for say a HUD that is active when the game is playing, but for lets say an inventory window, why not? The performance hit is very small if you are opaque with the subviews… the biggest performance hit is not when you have UIKit on top of OpenGL, its when you have an OpenGL layer on top of UIKit with opacity.

What I mean is its silly to do a ton of UI work with OpenGL/Cocos2d when you can use UIKit for just about anything that isn’t related to high performance rendering. And since Core Animation supports all layer types (including OpenGL), you can very easily animate transitions. The iPhone graphics core is itself OpenGL :)

June 20, 2010 at 4:55 am #287306

robodude666
@robodude666

Yea, totally. I was originally going to create a custom class implementation of most UIKit elements for Cocos2D, but after listening to the Model-View-Controller talk I decided against it as Apple has already done all of the heavy lifting for us. Now looking at ways to more smoothly implement UIKit elements into a Cocos2D application.

The thing that confuses me the most about this all is how exactly Cocos2D works versus how a traditional UIKit+Nib-based application works. Just find OpenGL a little too much to worry about. The whole EAGLView and ES1/ES2Renderer files are confusing. They seem to do magic out of no where.

How would I go about animating a CCLayer using Core Animation? I understand the basic:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3];
// Stuff here
[UIView commitAnimations];

but what exactly is “Stuff Here” in this case? How would I go about doing a transition using Core Animation between two different layers/scenes?

Guess I’ll watch the Core Animation in Practice stuff next :P.

-robodude666

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.