Closed TazmanNZL closed 9 years ago
It should be the same way you convert a point to any other node, though it's been a while since I've done that. have a look here.
On Tue, Dec 9, 2014 at 12:09 PM, TazmanNZL notifications@github.com wrote:
Heya,
Is there a way of finding what the x and y position is of a tile in world co-ordinates?
I can get the tile coordinates in the map itself but I don't know how to convert this to world x and y position. (What is the position of the tile in the scene?)
— Reply to this email directly or view it on GitHub https://github.com/slycrel/JSTileMap/issues/24.
I tried that but does' that just set (0,0) on the node? Cause it's not giving me the node's position in the scene.
SKNode tileNode = [[self.map layerNamed:theLayer.name] nodeAtPoint:tileCoord]; SKNode testNode = [SKNode node]; [testNode convertPoint:CGPointMake(0, 0) fromNode:tileNode];
Not sure if I am doing it right but I'm getting (0,0) back for testNode's position ??
Hi @TazmanNZL,
I hope you have figured out this issue. An example on top of the above stack overflow link of what you describe could be done similar to this:
CGPoint convertedPosition = [yourGameScene convertPoint:theSprite.position fromNode:yourSprite];
Heya,
Is there a way of finding what the x and y position is of a tile in world co-ordinates?
I can get the tile coordinates in the map itself but I don't know how to convert this to world x and y position. (What is the position of the tile in the scene?)