http://pastebin.com/JM1ckbKtThe problem is that clicking on a new target position or dragging the mouse while the spaceship is in motion will cause the ship to follow the cursor, but I am trying to do 1 click, spaceship flies there and cannot redirect before it reaches the target. I tried to achieve this by not letting it change the target position with the flag (!m_moving) while flying and I tested this by debugging it and it seems the target is not changing which is great which is why im confused as to why it lets me do this. I've disabled repeated key presses for the windows.
The second problem is the boundaries, sometimes it works correctly but often it won't, the spaceship will fly through at times. I've printed out targetposition vs the distancetotravel, and it showed it working for a while and then eventually (the targetposition starts increasing when it should be gradually decreasing before it satisfies the condition that targetposition