Skip to content

Commit

Permalink
Merge pull request #575 from tjvr/goto-random
Browse files Browse the repository at this point in the history
Add go to random position
  • Loading branch information
nathan committed Mar 19, 2016
2 parents c37a20e + a06385b commit 49c8d28
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions phosphorus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,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;
Expand Down

0 comments on commit 49c8d28

Please sign in to comment.