And you were using cos function wrong.
You don't even know what COS, SIN, TG, CTG, ARCCOS, ARCSIN and all the freakin trigonometry works.
Just give a basic questions and we'll show how stuff works.
function fwdcalc(rot,x,y,factor) 	if rot<-90 then rot=rot+360 end 	local angle=math.rad(math.abs(rot+90))-math.pi 	local cx=x+(math.cos(angle)*factor) 	local cy=y+(math.sin(angle)*factor) 	return cx,cy end
DEG_TO_RAD = 0.0174532925199432957692369076848861 math.cos(ANGLE*DEG_TO_RAD)
math.cos(math.rad(ANGLE))