Game Development Reference
In-Depth Information
nodes added before that node. This allows cocos2d to order nodes without using a
depth buffer.
If you enable depth buffering, you can also use the vertexZ property to change each
node's draw order freely. Cocos2d requires this freedom in order to let the
cc_vertexz tilemap property work its magic. Later you'll manipulate the ver-
texZ property of the player character to correctly draw the player sprite in front of or
behind other isometric tiles.
Locating an Isometric Tile
The next thing to do is determine from a touch location the coordinates of the touched
tile. You can find this code in the IsoTilemap01 project. Before I get to that, let's see
what the interface and implementation of the TileMapLayer class look like thus far.
It's nothing you haven't seen before:
// TileMapLayer.h
#import "cocos2d.h"
enum
{
TileMapNode = 0,
};
@interface TileMapLayer : CCLayer
{
}
+(CCScene *) scene;
@end
// TileMapLayer.m
#import "TileMapLayer.h"
@implementation TileMapLayer
+(CCScene *) scene
{
CCScene *scene = [CCScene node];
TileMapLayer *layer = [TileMapLayer node];
Search Nedrilad ::




Custom Search