Quote: "Issue 1 - the little guys need to rotate to face the way they are moving. They can move in only the 8 basic directions, and I can manually set the angle to be correct, however I want to have them actually rotate to face the correct way, not just suddenly be facing that way. But here's the problem; if the sprite is facing up, it's rotation is 0. If it then moves right, it would need to rotate 90 degrees. No problem. But if it turns left, it needs to rotate -90 degrees. Problem. When I read the angle the sprite is currently at, and I know the angle it should be facing, how do I work out which direction to rotate in is quickest? I.e. for turning left, how do I calculate that -90 degree angle?"
Not sure I completely understand the question... Is this the sort of code you're looking for?
//(all variables should be floats in reality)
cA=0 //Current Angle
nA=0 //New Angle
angleSpeed=0 //Angle Speed..
//EVENT! Change the angle to which ever way you're now facing. These lines should only occur once (each time the player changes angle)
nA=-90
angleSpeed=nA/10 //current speed the player is rotating, sign of the var is the direction
//THESE LINES SHOULD OCCUR EVERY LOOP
//If the current sprite angle is != the angle it's supposed to be, then rotate it until it is (will take 10 frames exactly)
do
if cA<>nA
cA=cA+angleSpeed
endif
loop
Quote: "Issue 2 - when they start shooting, I need bullet sprites to move in non linear ways, to allow for poor accuracy over distance. I considered using floats for the positions so that rounding would naturally have them move, however how do I calculate the angle? What I mean is, if a sprite is on row 1, and he shoots a sprite on row 3 that is 5 spaces away - pie can give me the distance to him, but how do I get that angle so that I can set the floats correctly and make the bullet navigate towards the unit which was shot?
"
Okay, this is actually much easier if you
don't use angles at all!
Just do it like this:
type bullet
x as float //Pos
y as float
xs as float //Velocity Vector
ys as float
endtype
asdf as bullet
asdf.x=1.0 //player position at the instant the bullet is fired
asdf.y=2.0
//[Target enemy is at 3.0,7.0]
asdf.xs=(asdf.x-3.0)/5.0
asdf.ys=(asdf.y-7.0)/5.0
//Update the asdf.x/y=asdf.x/y+asdf.xs/ys each frame, bullet will take 5 frames to arrive at target
the problem is if you want to rotate the bullet in the right direction, in that case you need to use Trig, if you want help with it, I can give you a few tips, but I'm not that great at it either