Thread:Randomouscrap98/@comment-5106053-20140805195949/@comment-9531161-20140805233215

Hmm, well in that case, I'd work with velocities:

At the top, make a constant to make life easier:

DIAG=SQRT(2)/2

Then change the movement code to:

VX=((B AND 8)>0)-((B AND 4)>0) VY=((B AND 2)>0)-((B AND 1)>0) IF ABS(VX)+ABS(VY)>1 THEN VX=SGN(VX)*DIAG:VY=SGN(VY)*DIAG X=X+VX:Y=Y+VY SPOFS 0,X,Y

Of course, we still have the problem of sprite directions. Depending on how you want to handle diagonals, you could either have 4 IF statements that check the velocity, or you could calculate the correct sprite using a math equation. A final route is to create an array which contains the sprite number you want to use for each button press, and just always set the sprite by indexing the array at B. Something like:

SPCHR 0,DIR[B]

As to whether or not this is better... well, it's all personal preference. Handling diagonals gets ugly quickly when you start to worry about velocity. If you're worried about performance, variable assignment seems to be the biggest hit, followed closely by interpretation speed. This means that if you want your code to run fast, you make as few assignments as possible while also trying to keep your code short (in terms of characters).

I'm sorry if I didn't answer your question the way you wanted it answered.