ID:2133910
 
(See the best response by Nadrew.)
Code:
mob/player
verb
TurnLeft()
set hidden = 1
if(dead)return
angle +=4
//if(angle > 360)
// angle = 0
var/icon/I = icon('Truck.dmi', "truck")
I.Turn(-angle)
icon = I
TurnRight()
set hidden = 1
if(dead)return
angle -=4
// if(angle < 0)
// angle = 360
var/icon/I = icon('Truck.dmi', "truck")
I.Turn(-angle)
icon = I


Problem description:

I am wondering if its better to reset angle to 360 rather than stack angle to infinity or it doesn`t really matter at all.



I have a pretty nice way of clamping angle within [180, 180):
angle = round(angle, 360) - angle

Also, I recommend using transform instead of icon.Turn() for rotating your objects. It's rendered client-side, so the server doesn't do nearly as much computation:
// set transform to the default transform rotated by
// [angle] degrees clockwise
transform = turn(matrix(), angle)
Maybe thats also the reason why would the hole icon disappear sometimes.

I appriciate your help, thanks!

Edit:

It seems I cannot use
transform = turn(matrix(), angle)
since this is already used when you move your mosue for the other object. If I do use it the hole screen will be moving


screenshot: http://prnt.sc/c79j7a


Best response
That's because you're applying client.transform and not mob.transform.
I was really thinking to make 90 icons. Thanks :)