unfortunately I have a supposedly simple "problem".
The Situation: I want to code my first "space shooter ... or something like that" with SpriteKit So I have (currently :-)): One Node, Three Buttons: 1 button for turning left, 1 for right & 1 for acceleration.
Turning is solved. Using impulse for giving the node a new direction
...The problem is :
Acceleration. I also use the impulse for getting the node "forward". But it don't want to move forward in the direction in which the node was turned.
My ideas solving the Problem: using the radiant of the zRotation, calculating the degrees, figuring out the CGVector via using "rad * cos(degree)" / "rad * sin(degree)".
result
- the node is not moving in the direction it should. especially if the rad is a negative figure ... :-D
So question is: How can I set an impulse / velocity for moving my future spaceship forward to the set direction .
thanks for your help!
greetings Sascha