From f6c0760798c9190ba140195f945a93ed8a47ffff Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 6 Aug 2012 06:44:22 +0200 Subject: [PATCH] Add Subtract function for Points --- core.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core.js b/core.js index 6a22cc7..1373e8a 100644 --- a/core.js +++ b/core.js @@ -187,6 +187,19 @@ Function.prototype.inheritsFrom = function(parentObject) return new_point; } + + this.Subtract = function() + { + var new_point = new RadiumEngine.Point(this.x, this.y); + + for (i in arguments) + { + new_point.x -= arguments[i].x; + new_point.y -= arguments[i].y; + } + + return new_point; + } } var /*Static*/ point_distance = RadiumEngine.point_distance = function(x1, y1, x2, y2)