2013-01-08 01:48:09 +01:00
|
|
|
load(__folder + "drone.js");
|
2013-01-04 02:05:11 +01:00
|
|
|
//
|
|
|
|
// Create a floor of colored tiles some of which emit light.
|
|
|
|
// The tiles change color every second creating a strobe-lit dance-floor.
|
|
|
|
//
|
|
|
|
// See it in action here => http://www.youtube.com/watch?v=UEooBt6NTFo
|
|
|
|
//
|
2013-01-03 21:04:03 +01:00
|
|
|
Drone.extend('dancefloor',function(width,length)
|
|
|
|
{
|
|
|
|
if (typeof width == "undefined")
|
|
|
|
width = 5;
|
|
|
|
if (typeof length == "undefined")
|
|
|
|
length = width;
|
2013-01-03 21:16:58 +01:00
|
|
|
//
|
|
|
|
// create a separate Drone object to lay down disco tiles
|
|
|
|
//
|
2013-01-03 21:04:03 +01:00
|
|
|
var disco = new Drone(this.x,this.y, this.z, this.dir);
|
2013-01-03 21:16:58 +01:00
|
|
|
//
|
2013-01-03 21:04:03 +01:00
|
|
|
// under-floor lighting
|
2013-01-03 21:16:58 +01:00
|
|
|
//
|
2013-01-03 21:04:03 +01:00
|
|
|
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];
|
|
|
|
//
|
2013-01-08 01:48:09 +01:00
|
|
|
// strobe gets called in a java thread - disco only lasts 30 seconds.
|
2013-01-03 21:04:03 +01:00
|
|
|
//
|
2013-01-08 01:48:09 +01:00
|
|
|
var discoTicks = 30;
|
|
|
|
var strobe = function()
|
|
|
|
{
|
|
|
|
while(discoTicks--)
|
|
|
|
{
|
2013-01-03 21:16:58 +01:00
|
|
|
disco.rand(floorTiles,width,1,length);
|
2013-01-03 21:04:03 +01:00
|
|
|
java.lang.Thread.sleep(1000);
|
|
|
|
}
|
2013-01-03 21:16:58 +01:00
|
|
|
};
|
|
|
|
var thread = new java.lang.Thread(strobe);
|
2013-01-03 21:04:03 +01:00
|
|
|
thread.start();
|
|
|
|
return this;
|
|
|
|
});
|