Im working on a little game in IOS which involves a scrolling tilemap. I have gotten my background picture to scroll like so
- (void)moveBg
{
[self enumerateChildNodesWithName:@"scroll" usingBlock:
^(SKNode *node, BOOL *stop) {
SKSpriteNode * bg = (SKSpriteNode *) node;
CGPoint bgVelocity = CGPointMake(-BG_POINTS_PER_SEC, 0.0);
CGPoint amtToMove = CGPointMultiplyScalar(bgVelocity, _dt);
bg.position = CGPointAdd(bg.position, amtToMove);
}];
}
however if i load my tilemap and name it "scroll" as i have below
- (TileMapLayer *)createLandScape
{
_tileMap = [JSTileMap mapNamed:@"level1.tmx"];
_tileMap.name=@"scroll";
return [[TmxTileMapLayer alloc]
initWithTmxLayer:[_tileMap layerNamed:@"Background"]];
}
I am lead to believe that tilemap scrolling is then different from background image scrolling. Id like if someone could help me or point me to the right direction ton accomplish ths.
Thanks!