アプリの途中で画面を分割し、半分にマップを表示し、残りの半分にキャラクターのインベントリ/コマンドのリストを表示したいと考えています。マップを画面の左側にのみレンダリングする方法はありますか? たとえば、次のコードのようなもの:
// Load in the tile map file
self.tileMap = [CCTMXTiledMap tiledMapWithTMXFile:@"TileMap.tmx"];
// Set the backogrund to be the background layer in that map
self.background = [_tileMap layerNamed:@"Background"];
self.foreground = [_tileMap layerNamed:@"Foreground"];
// Add the map to this window, with a low z-index
CGSize winSize = [[CCDirector sharedDirector] winSize];
// This doesn't work, as there is no set on boundingBox
// And I not sure it would anyway
_tileMap.boundingBox = (CGRect){0,0,winSize.width/2,winSize.height};
[self addChild:_tileMap z:-1];
私は現在、画面のその側をボックスで覆うマップの上にレイヤーを配置することで動き回っていますが、それは非常にハッキーに感じます/それが私に裏目に出るように感じます. このアプローチの利点の 1 つは、インベントリ画面を「フェード」するだけで、ユーザーが再び表示するまでマップ全体にアクセスできる可能性があることです (ただし、マップの右側に到達するなどの問題が発生する可能性があります)。 )