Board Thread:Questions and Answers/@comment-24837408-20150816112745/@comment-26059560-20150816132752

haha. I just made a game with mechanics like this. Check it out.

http://petitcomputer.wikia.com/wiki/Asteroids(atari)

So, to rotate a character, you use spangle which is in degrees and sphome 0,8,8 to focus in on the center of the dot. Now, the tough part is moving it. this is really tough. It took a lot of messing around but I remembered back to trigonometry class and stuff like sine, cosine, and tangent, the three main trigonometric functions. for this, you will need sine and cosine. radians are much easier to work with in math, so you will need a rad(angle) command since that's all ptc uses with trig. look up a picture of a sinusoidal or cosinusoidal graph. it looks like a wave, because a sine function, if starting at 0 degrees and going clockwise, will start at 0, increase to 1 at 90 degrees, go bacck to 0 at 180 degrees, decrease to -1 at 270 degrees, and up to 0 at 360. cosine will yield 1,0,-1,0 at the 4 points on the circle. tangent will not work because tan(90) results in an error because of triangles....and stuff. now this is extremely helpful, because the sin and cos functions have values that correspond to actually moving on a 4-direction grid. now you just need a parameter for the speed, depending on how fast you want them to move. 2 is nice for characters. so the algorithm looks something like this:

R=RAD(ANG)

X=SIN(R)*2+X

Y=COS(R)*2+Y

SPOFS 0,X,Y

I didn't come up with this on my own for the most part. I got this from the graphic sample program with the gpage example.