Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Snippet: Get vector by using distance and angle from a source sprite — Gideros Forum

Snippet: Get vector by using distance and angle from a source sprite

MikeHartMikeHart Guru
edited January 2012 in Code snippets
This is a function, that will determine a vector with a given source sprite, the distance from it and the angle:
getVector = function(source, dist, angle)
	local a = math.rad(angle)
	local x = source:getX() + math.sin(a) * dist
	local y = source:getY() - math.cos(a) * dist
	return x,y	
end
Sign In or Register to comment.