card/proc/SwitchPos(var/card/D,var/mob/C,p as num)
if(p == 1)
D.dir = turn(C.dir,0)
D.bPos = 0
return
D.dir = turn(C.dir,90)
D.bPos = 1
return
Problem description:
So I was trying to figure this out as my new team mate showed me it as it will save code lines. Originally it started to work but after deleting the states (Which I read that they are not needed) and we tried figuring it out but nothing happens. Help :/
About your code:
* You defined SwitchPos() as a /card proc, but you're passing the card you're operating on as D instead of just using src.
* You also defined p as the opposite of what you want the card's bPos to end up as.
* You're using turn(dir, angle) properly, but unless your card icon actually has those directions, it's not going to do anything.
If you want to rotate an atom's icon dynamically, you set atom.transform using the matrix() proc and maybe turn(matrix, angle).