Wes Mantooth - HTML5 Canvas Game Engine - Version 2.x - by Jeremy Heminger

Classes organised alphabetically

Motion

distance_to_point -> {Number}

return the distance between two poins

Name Type Description
x1Numberx1 coordinate
y1Numbery1 coordinate
x2Numberx2 coordinate
y2Numbery2 coordinate

point_direction -> {Number}

returns the direction of x2,y2 from x1,y1 in radians or degrees

Name Type Description
x1Numberx1 coordinate
y1Numbery1 coordinate
x2Numberx2 coordinate
y2Numbery2 coordinate
radians Boolean true return radians
false return degrees

motion_set -> {Array}

updates an x,y position in a direction based on speed

Name Type Description
x Number
y Number
degrees Number If using degrees you must ensure that you are passing a whole number
A float point number will be assumed to be in radians