Chapter 5 - Challenge "correction" - correcting SpawnEnemy's Speed

Now that we’re done with Chapter 5, the entire “game” moves to the left constantly.
This means that even with the suggested answer to the challenge, the enemy still moves too quickly (the Lady Cat supposed to move out of the screen in 2 seconds, but she does it faster due to the movement of the camera). This is caused as the Lady Cat will move to the “old” location that was generated when it was spawned - but the camera moved - so it feels as she’s moving faster.

This could be compensated, as we know the duration of the move action (either using the moveByX:y:duration or moveToX:duration) by multiplying the duration of the animation by the camera move speed per sec.

let actionMove = SKAction.moveToX(CGRectGetMinX(cameraRect) - enemy.size.width/2 + cameraMovePointsPerSec * 2.0, duration: 2.0)


let actionMove = SKAction.moveByX(-cameraRect.size.width - enemy.size.width + cameraMovePointsPerSec * 2.0, y: 0, duration: 2.0)

This way we make sure that the enemy indeed takes 2 seconds to move out of the screen.