# Simple(Or so I thought..) 2D math

Ok, basically I’m making a small game that communicates over the network, now the network code works fine, but this is my first time programming in OpenGL.

I’ve got it setup where 4 rotates left, 6 rotates right, and 8 is up and 5 & 2 are down.

I can’t seem to get the coordinate updates to work I can rotate just fine but when I press 8 to go forward it goes some random(or so it seems direction)

what is an easy way to solve this?

When you rotate, you’re also rotating your axes. Pressing 8 after a rotation will cause a forward motion with respect to your new axes, which is why you’re not seeing the kind of motion you’re expecting.
Try using quaternions for your rotations.

there is absolutely no need for quaternions in this situation. Use sin and cos to decompose the angle and magnitude into x and y coordinates. So

X+=vcos(angle)
Y+=v
sin(angle)

something like that

Ok, So the axes rotate at with the same incrementation we use to rotate our object?

Right now we have it rotating + or - 10.0f.

The way we had it set up is basically like this to change x & y:
float nXPos, nYPos = 0;
//nMovement is 3 pixels
//this is for hitting ‘8’