{"action":"created","issue":{"url":"https://api.github.com/repos/TomLinthwaite/SKTilemap/issues/12","repository_url":"https://api.github.com/repos/TomLinthwaite/SKTilemap","labels_url":"https://api.github.com/repos/TomLinthwaite/SKTilemap/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/TomLinthwaite/SKTilemap/issues/12/comments","events_url":"https://api.github.com/repos/TomLinthwaite/SKTilemap/issues/12/events","html_url":"https://github.com/TomLinthwaite/SKTilemap/issues/12","id":150641824,"number":12,"title":"Coordinate System does not match SpriteKit","user":{"login":"riklowe","id":15182608,"avatar_url":"https://avatars.githubusercontent.com/u/15182608?v=3","gravatar_id":"","url":"https://api.github.com/users/riklowe","html_url":"https://github.com/riklowe","followers_url":"https://api.github.com/users/riklowe/followers","following_url":"https://api.github.com/users/riklowe/following{/other_user}","gists_url":"https://api.github.com/users/riklowe/gists{/gist_id}","starred_url":"https://api.github.com/users/riklowe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riklowe/subscriptions","organizations_url":"https://api.github.com/users/riklowe/orgs","repos_url":"https://api.github.com/users/riklowe/repos","events_url":"https://api.github.com/users/riklowe/events{/privacy}","received_events_url":"https://api.github.com/users/riklowe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-24T08:53:58Z","updated_at":"2016-04-24T11:56:42Z","closed_at":null,"body":"By default - Tiled coordinate system puts (0,0) in the top left\r\nBy default - SpriteKit coordinate system puts (0,0) in the bottom left \r\n\r\nThis is resulting in Y values that start at 0 and reduce to -screen size\r\nTo correct this - I believe you can add Screen Height to the y position when tiles are loaded.\r\n\r\nIn SKTilemapLayer -  fun tilePositionAtCoord\r\n\r\nchange\r\n\r\n        case .Orthogonal:\r\n            \r\n            position = CGPoint(x: x * Int(tileSize.width) + Int(tileAnchorPoint.x * tileSize.width),\r\n                               y: y * Int(-tileSize.height) - Int(tileSize.height - tileAnchorPoint.y * tileSize.height))\r\n\r\nto\r\n\r\n        case .Orthogonal:\r\n            \r\n            let tmpMapSize = Int(tilemap.size.height * tileSize.height)\r\n            let tmpYpos = y * Int(-tileSize.height) - Int(tileSize.height - tileAnchorPoint.y * tileSize.height)\r\n\r\n            position = CGPoint(x: x * Int(tileSize.width) + Int(tileAnchorPoint.x * tileSize.width),\r\n                               y: tmpMapSize + tmpYpos)\r\n\r\n\r\nTesting seems to produce the correct results with Y values now starting at 0 in the bottom of the screen\r\nAdditionally this change did not seem to produce any other side effects (but will require more testing)\r\n\r\nLet me know what you think\r\n\r\nRgds\r\nRichard\r\n"},"comment":{"url":"https://api.github.com/repos/TomLinthwaite/SKTilemap/issues/comments/213947593","html_url":"https://github.com/TomLinthwaite/SKTilemap/issues/12#issuecomment-213947593","issue_url":"https://api.github.com/repos/TomLinthwaite/SKTilemap/issues/12","id":213947593,"user":{"login":"TomLinthwaite","id":12601809,"avatar_url":"https://avatars.githubusercontent.com/u/12601809?v=3","gravatar_id":"","url":"https://api.github.com/users/TomLinthwaite","html_url":"https://github.com/TomLinthwaite","followers_url":"https://api.github.com/users/TomLinthwaite/followers","following_url":"https://api.github.com/users/TomLinthwaite/following{/other_user}","gists_url":"https://api.github.com/users/TomLinthwaite/gists{/gist_id}","starred_url":"https://api.github.com/users/TomLinthwaite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomLinthwaite/subscriptions","organizations_url":"https://api.github.com/users/TomLinthwaite/orgs","repos_url":"https://api.github.com/users/TomLinthwaite/repos","events_url":"https://api.github.com/users/TomLinthwaite/events{/privacy}","received_events_url":"https://api.github.com/users/TomLinthwaite/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T11:56:42Z","updated_at":"2016-04-24T11:56:42Z","body":"I'll have to have a proper look at this when I get home. I don't really want to follow tileds coordinate system because for everything else not related to the map in your game code you'll stick to sprite kits cooed system. Even if you draw the Sprite below you still have to position what ever nose your position in the opposite y. If you have to position something on a tile just use the tiles position instead of hard coding. Like I said I'll have a look when I get back from work but I'm pretty sure I want to stick to how Sprite kit does it. If you want to change the anchor point of the tiles look at the Orientation emus and change it there for what ever orientation your using. "}}