Learn trigonometry for game programming using SpriteKit and Swift. You will learn the theory and then practice using trigonometry by making a space shooter game!
Great job with this tutorial, particularly the rotation blending, which is awesome - I have one issue; in my game, I lock the screen orientation, so if the player tilts too far forward, the screen doesn’t flip on them - however, if I tilt too far forward, my player sprite reverses direction, and moves toward me instead of away from me. If I relax the tilt, the sprite will reverse again, and correctly move away from me. Tilting back does not do this regardless of the degree I may tilt the device. I’m assuming there’s a way to control forward tilting so this does not happen, but I can’t put my finger on it? Thanks for any guidance.
False alarm! The problem turned out to be far simpler than I thought, and completely unrelated to this topic: I wasn’t handling the change in screen orientation properly; once I changed what I was doing to the following, it worked like a charm:
Hi the tutorial is very good and I am really enjoying it. I am not able to implement the blending of the old angle with the new one for the turret, which will in turn make the turret a little bit slower than the player’s ship. Thanks for any guidance.