Is there a way to mark the drone location?
I am just starting with ScriptCraft. I'm trying to figure out where my drone is. I'd really like to use this like logo.
Is there a way to mark the drone location? Flashing block or something?
I tried adding this bit of code to the drone.js file but sadly I don't get a blink...
....
that = this;
setInterval(function(){
if(this.off)
that.box(blocks.oak);
else
that.box(blocks.air);
console.log("test");
}, 2)
return this;
};
@walterhiggins Thanks for the reply.
I was able to use your code slightly modified to achieve blinking.
var strobe = true;
var me = this;
setInterval(function(){
me.box(strobe?blocks.glowstone:blocks.air);
strobe = !strobe;
}, 2000);
I guess there are a lot more problems with this approach than I was originally thinking. If the user inworld creates a drone /js var d=new Drone(); then moves the drone when the "strobe" is on /js d.up() then the "strobe" block will be left behind. Also if the user drops a block and waits too long before moving the drone, the drone will replace it with the strobe.
I guess I'm not sure how to proceed. I'd really like to use drones like logo turtles with students.
You could spawn an anilmal (say - a duck) and have the animal track the drone's location - the problem would be choosing where best to position the animal relative to the drone's location - if placed at the exact location it will suffocate as blocks are built.
I like this idea. To make this fully usable, the various drone operations will need to accommodate the functionality.
Looking at http://scratch.mit.edu, Scratch supports the pen down and pen up operations, similar to Logo and Kojo. I wonder if this would work in the drone context. Instead of using a strobe, perhaps the user could set a block a type as the pen and when the pen is down the Drone is shown as a (non-strobing) block.
So, I started to break this down into some BDD stories. There are some tricky parts already with these two basic scenarios.
Story: The drone can show its current location
In order to show how the drone is moving As a player I want to be able to make the drone's location on and off. Note: The default is off and that should be its own scenario.
Scenario 1: Make the drone visible Given a drone d And the drone is visible or invisible When d.show() is called Then the drone can be seen as a black wool block, possibly replacing an existing block at the same exact drone location TBD: What is returned by an operation requesting the block at the drone's location?
Scenario 2: Make the drone invisible Given a drone d And the drone is visible or invisible When d.hide() is called Then the block at the drone's location is replaced by the block that was there when a previous d.show() operation was invoked or else an empty block (air).
Hmm, tricky tricky tricky. I know its been a while since this issue was opened, but I'm interested in working on the animal solution. I just can't seem to figure out how to spawn and keep a reference to an animal. I like the approach Computercraft took having a block act as the "drone" the semantics are a bit different though. Maybe that type of api is better in the sense that there is always a block in the world that will move around. http://computercraft.info/wiki/Turtle_(API)
Thoughts?