function riseRunAngle(angle,dis)
	if angle <=360 and angle >= 1 then
		if riseRunAngleVar == nil then
			riseRunAngleVar = {
				rise = 0,
				run = 0,
			}
		end
		if angle == 360 then
			riseRunAngleVar.rise = 0
			riseRunAngleVar.run = dis
		elseif angle == 90 then
			riseRunAngleVar.run = 0
			riseRunAngleVar.rise = dis
		elseif angle == 180 then
			riseRunAngleVar.rise = 0
			riseRunAngleVar.run = dis*-1
		elseif angle == 270 then
			riseRunAngleVar.run = 0
			riseRunAngleVar.rise = dis*-1
		else
			riseRunAngleVar.rise = dis*math.sin(angle*(math.pi/180))
			riseRunAngleVar.run = math.sqrt(dis^2-riseRunAngleVar.rise^2)
			if angle < 270 and angle > 90 then
				riseRunAngleVar.run = riseRunAngleVar.run*-1
			end
		end
		return riseRunAngleVar.rise,riseRunAngleVar.run
	else
		return nil,nil
	end
end
function riseRunPos(oldx,oldy,newx,newy)
	riseM = newy - oldy
	runM = newx - oldx
	while riseM > 1 or riseM < -1 or runM > 1 or runM < -1 do
		riseM = riseM/2
		runM = runM/2
	end
	return riseM,runM
end
function analogControl(controller,maxDis)
	analogAngleVar = {
		x = controller:analogX(),
		y = controller:analogY(),
		angle = 0,
		dis = 0,
	}
	if analogAngleVar.x == 0 then 
		if analogAngleVar.y == math.abs(analogAngleVar.y)*-1 then 
			analogAngleVar.angle = 270 
		else 
			analogAngleVar.angle = 90 
		end 
	elseif analogAngleVar.y == 0 then 
		if analogAngleVar.x == math.abs(analogAngleVar.x)*-1 then 
			analogAngleVar.angle = 180 else analogAngleVar.angle = 360
		end 
	elseif analogAngleVar.x ~= 0 and analogAngleVar.y ~= 0 then
		if analogAngleVar.x == math.abs(analogAngleVar.x)*-1 and analogAngleVar.y ~= math.abs(analogAngleVar.y)*-1 then
			analogAngleVar.angle = 180 + math.atan(analogAngleVar.y/analogAngleVar.x)*57.295779513
		elseif analogAngleVar.x == math.abs(analogAngleVar.x)*-1 and analogAngleVar.y == math.abs(analogAngleVar.y)*-1 then
			analogAngleVar.angle = 180 + math.atan(analogAngleVar.y/analogAngleVar.x)*57.295779513
		elseif analogAngleVar.x ~= math.abs(analogAngleVar.x)*-1 and analogAngleVar.y == math.abs(analogAngleVar.y)*-1 then
			analogAngleVar.angle = 360 + math.atan(analogAngleVar.y/analogAngleVar.x)*57.295779513
		elseif analogAngleVar.x ~= math.abs(analogAngleVar.x)*-1 and analogAngleVar.y ~= math.abs(analogAngleVar.y)*-1 then
			analogAngleVar.angle = math.atan(analogAngleVar.y/analogAngleVar.x)*57.295779513
		end
	end
	if analogAngleVar.angle < 1 then
		analogAngleVar.angle = 1 
	elseif analogAngleVar.angle > 360 then
		analogAngleVar.angle = 360 
	end
	if maxDis ~= nil then
		local disProp = 50 * maxDis / 3
		if math.abs(analogAngleVar.x) > math.abs(analogAngleVar.y) then
			analogAngleVar.dis =  math.abs(analogAngleVar.x)/disProp 
		else 
			analogAngleVar.dis = math.abs(analogAngleVar.y)/disProp
		end
		return analogAngleVar.angle,analogAngleVar.dis
	else
		return analogAngleVar.angle
	end
end
