Hi, I’ve just completed the first two games of the book and I have to tell that I’ve learned a lot, but I also noticed something weird while I’m following the tutorial for the third game.
It seems like the left and right boundaries of the game aren’t right for different platforms. I don’t know if it’s my mistake, but I also tried playing the already finished game and I still see this problem (I used the simulator).
For example to check when to place the player on the right side of the scene we do:
var playerPosition = convertPoint(player.position, fromNode: fgNode)
if playerPosition.x < -player.size.width/2 {…}
The problem is that when I move the player to the left part (or right) of the scene, it stays a lot of time offscreen until it appears on the right side. This means that the scene is “scaled”, by this I mean that the left boundary (end visible area) isn’t the same as “x=0” but it has to go more to the left until it reaches that point of the scene (and we already used the conversion from the fgNode, so we’re calculating on scene coordinates with anchor point on bottom-left). Is there a way to solve this problem? (I noticed the problem on different devices, e.g iphone 6)
I tried to use the method used for the Zombie Conga (using a CGRect) but for larger devices the rectangle appears smaller than the visible area (and you see the player going from left to right while visible on screen). So this isn’t a nice solution.
Did I miss something (even though I also checked on already finished file) or is it just something to fix, if so, how can I fix this?
PS: I know that we check when x is smaller than -player.size.width/2, but this isn’t the problem, even if I check for x<0 it has this problem.