I’m building a game which have forever scrolling ground. Ground have some holes,and game over when player fall into a hole. I can scrolling background. But I can't scrolling "Ground" which have PhysicsBody (and player can stand).
I tried 2 ways,like this.
1) Scrolling TileMap using JSTilemap It's made game running so slowly, and it not scrolling forever.
2) Scroll SpritNode from ground image file. There an error "PhysicsBody: Could not create physics body" when I use [SKPhysicsBody bodyWithTexture].
Which way is better? and , Isn't there any other way?
Thanks,
use simple SKNode class extends it my adding all holes and platform for e.g. SKNodebase addChild:hole and SKNodebase addChild:platform give each hole and platform a name for example hole.name="h1" now inside -(void)update:(CFTimeInterval)currentTime
[remember that your SKScene function would update -(void)update:(CFTimeInterval)currentTime function which you would have to write inside SKNodebase class]
[[self children] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
SKNode *node = (SKNode *)obj;
if ([node.name isEqual: @“hole”]) {
CGPoint position;
//node.position get position of node on each update
}
if([node.name isEqual: @“platform”])
{
CGPoint position;
//node.position get position of node on each update
}
}];