From a06385bf193b8160a1d6eb388721503f051ca736 Mon Sep 17 00:00:00 2001 From: tjvr Date: Sat, 19 Mar 2016 10:07:47 +0000 Subject: [PATCH] Add go to random position --- phosphorus.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phosphorus.js b/phosphorus.js index 3a144861..32cc2abe 100644 --- a/phosphorus.js +++ b/phosphorus.js @@ -1636,6 +1636,10 @@ var P = (function() { Sprite.prototype.gotoObject = function(thing) { if (thing === '_mouse_') { this.moveTo(this.stage.mouseX, this.stage.mouseY); + } else if (thing === '_random_') { + var x = Math.round(480 * Math.random() - 240); + var y = Math.round(360 * Math.random() - 180); + this.moveTo(x, y); } else { var sprite = this.stage.getObject(thing); if (!sprite) return 0;