Question

I am working on an iOS action game wherein the player travels between various "rooms," each of which is contained in a CCScene. When the player exits a room, the next one "slides" onto the screen via the wonderful built-in transitions provided by cocos2d.

The problem is, it's critical that my UI Control elements stay on the screen. They live in the bottom portion of the screen while the playing area is at the top. However, it appears that there may actually be no way of limiting the size of a CCScene so that it occupies only part of the screen.

I was hoping I could just tell cocos2d to make the CCScene node occupy a space smaller than the full screen:

CCScene* scene = [CCScene node];
scene.contentSize = CGSizeMake(200, 200);

But so far nothing like that has worked. The CCScene always occupies the full screen. I'm even okay with it if I have to move my UI control elements completly out of cocos2d to get this to work, using view controllers and what not. But right now I'm curious if what I'm trying to do is even possible within cocos2d.

Was it helpful?

Solution

Please take a look at EAGLViewTest in cocos2d tests directory. The intent of this test project is to use cocos2d only in the specified rectangle area. It is specified by EAGLView. And you can use Interface Builder for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top