diff --git a/docs/API-Reference.md b/docs/API-Reference.md index 5c47d81..9c8af23 100644 --- a/docs/API-Reference.md +++ b/docs/API-Reference.md @@ -3432,6 +3432,7 @@ Alternatively if you provide just a function as a parameter, then the function n #### Example 1 Using name and function as parameters // submitted by [edonaldson][edonaldson] + var Drone = require('drone'); Drone.extend('pyramid', function( block,height) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { @@ -3442,6 +3443,7 @@ Alternatively if you provide just a function as a parameter, then the function n #### Example 2 Using just a named function as a parameter + var Drone = require('drone'); function pyramid( block,height) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { diff --git a/docs/YoungPersonsGuideToProgrammingMinecraft.md b/docs/YoungPersonsGuideToProgrammingMinecraft.md index ba1b126..6796e8d 100644 --- a/docs/YoungPersonsGuideToProgrammingMinecraft.md +++ b/docs/YoungPersonsGuideToProgrammingMinecraft.md @@ -936,15 +936,16 @@ var myskyscraper = function(floors) { } this.chkpt('myskyscraper'); // saves the drone position so it can return there later for ( i = 0; i < floors; i++ ) { - this.box(blocks.iron,20,1,20) - .up() - .box0(blocks.glass_pane,20,3,20) - .up(3); + this + .box(blocks.iron,20,1,20) + .up() + .box0(blocks.glass_pane,20,3,20) + .up(3); } - return this.move('myskyscraper'); // return to where we started + this.move('myskyscraper'); // return to where we started }; -var Drone = require('../drone/drone').Drone; -Drone.extend('myskyscraper',myskyscraper); +var Drone = require('drone'); +Drone.extend( myskyscraper ); ``` ... so this takes a little explaining. First I create a new function diff --git a/src/docs/templates/ypgpm.md b/src/docs/templates/ypgpm.md index 5189f3b..a56b90b 100644 --- a/src/docs/templates/ypgpm.md +++ b/src/docs/templates/ypgpm.md @@ -894,15 +894,16 @@ var myskyscraper = function(floors) { } this.chkpt('myskyscraper'); // saves the drone position so it can return there later for ( i = 0; i < floors; i++ ) { - this.box(blocks.iron,20,1,20) - .up() - .box0(blocks.glass_pane,20,3,20) - .up(3); + this + .box(blocks.iron,20,1,20) + .up() + .box0(blocks.glass_pane,20,3,20) + .up(3); } - return this.move('myskyscraper'); // return to where we started + this.move('myskyscraper'); // return to where we started }; -var Drone = require('../drone/drone').Drone; -Drone.extend('myskyscraper',myskyscraper); +var Drone = require('drone'); +Drone.extend( myskyscraper ); ``` ... so this takes a little explaining. First I create a new function diff --git a/src/main/js/modules/drone/index.js b/src/main/js/modules/drone/index.js index 7910685..acaa1e7 100644 --- a/src/main/js/modules/drone/index.js +++ b/src/main/js/modules/drone/index.js @@ -210,6 +210,7 @@ Alternatively if you provide just a function as a parameter, then the function n #### Example 1 Using name and function as parameters // submitted by [edonaldson][edonaldson] + var Drone = require('drone'); Drone.extend('pyramid', function( block,height) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) { @@ -220,6 +221,7 @@ Alternatively if you provide just a function as a parameter, then the function n #### Example 2 Using just a named function as a parameter + var Drone = require('drone'); function pyramid( block,height) { this.chkpt('pyramid'); for ( var i = height; i > 0; i -= 2) {