Created
July 16, 2012 21:59
-
-
Save powerc9000/3125350 to your computer and use it in GitHub Desktop.
some vector stuff for peter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
degrees = angle * (180/Math.PI); | |
slope = tangent(degrees); | |
length = Math.sqrt(1*1,m*m); | |
vector = [1/length,m/length]; | |
next_point = function(distance,start,magnatude){ | |
var end = [] | |
magnatude[0] = magnatude[0]*distance; | |
magnatude[1] = magnatude[1]*distance; | |
end[0] = start[0] + magnatude[0]; | |
end[1] = start[1] + magnatude[1]; | |
return end; | |
} | |
next = next_point(ship.speed*modifier,[ship.x,ship.y],vector); | |
ship.x = next[0]; | |
ship.y = next[1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment