Hello i have some sprite and some map
-(id) init {
if( (self=[super init] )) {
    self.tiledMap = [CCTMXTiledMap tiledMapWithTMXFile:@"map3.tmx"];
    self.background = [_map layerNamed:@"Background"];
    [self.tiledMap runAction:[CCMoveBy actionWithDuration:10.0 position:ccp(0,-2750)]];
    [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"AnimBear.plist"];
    CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"AnimBear.png"];
    [self addChild:spriteSheet];
    NSMutableArray *walkAnimFrames = [NSMutableArray array];
    for (int i = 1; i <= 8 ; ++i) {
        [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"bear%d.png", i]]];
    }
    CCAnimation *walkAnim = [CCAnimation animationWith开发者_StackOverflow社区Frames:walkAnimFrames delay:0.1f];
    CGSize winSize = [CCDirector sharedDirector].winSize;
    self.bug = [CCSprite spriteWithSpriteFrameName:@"bear1.png"];
    _bug.position = ccp(winSize.width/2, winSize.height/2);
    self.walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
    [_bug runAction:_walkAction];
    [spriteSheet addChild:_bug];
    [self addChild:_map];
}
return self;
}
and my sprite is under map , but i need to draw sprite on map. How can i do it? tnaks
the problem is that ure missing the z value, that tells the order of the stuff,
[spriteSheet addChild:_bug z:2];
[self addChild:_map z:1];
The layer organizes the objects that are infront of or behind using zOrder the lowest the value, the far is the thing from the screen.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论