From 11e6c642ff3c31cc3abfb5b9d58c7c4f067c86a3 Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Thu, 3 Jan 2013 20:04:03 +0000 Subject: [PATCH] Added new dancefloor method and tweaks to CommandScript.java --- example_scripts/dancefloor.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 example_scripts/dancefloor.js diff --git a/example_scripts/dancefloor.js b/example_scripts/dancefloor.js new file mode 100644 index 0000000..78f5ed4 --- /dev/null +++ b/example_scripts/dancefloor.js @@ -0,0 +1,26 @@ +load($SCRIPT_DIR + "/../drone.js"); +Drone.extend('dancefloor',function(width,length) +{ + if (typeof width == "undefined") + width = 5; + if (typeof length == "undefined") + length = width; + var disco = new Drone(this.x,this.y, this.z, this.dir); + // under-floor lighting + disco.down().box(89,width,1,length).up(); + var floorTiles = [35,35,'35:1','35:2','35:3','35:4','35:4','35:4','35:6',20,20]; + // + // strobe gets called in a java thread + // + var strobe = function(){ + disco.rand(floorTiles,width,1,length); + }; + thread = new java.lang.Thread(function(){ + while(true){ + strobe(); + java.lang.Thread.sleep(1000); + } + }); + thread.start(); + return this; +});