Skip to content

Instantly share code, notes, and snippets.

@daigofuji
Created January 7, 2015 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daigofuji/e1b39a9d39baac4c1705 to your computer and use it in GitHub Desktop.
Save daigofuji/e1b39a9d39baac4c1705 to your computer and use it in GitHub Desktop.
ScriptCraft drone plugin for space invader 8-bit art
var Drone = require('../drone').Drone;
var blocks = require('blocks');
/************************************************************************
### Drone.invader() method
Creates an 8-bit space invader, 11 blocks wide and 8 blocks high,
made out of black wool, unless otherwise specified.
#### Parameters
* none
#### Example
/js invader()
select a ground, it starts to construct invader right above it, facing you.
***/
Drone.extend('invader', function(theblock){
// need 4 colors brown (N), blue (B), red (R), and orange (O)
var B = "35:11";
if ( typeof theblock !== 'undefined' ) {
B = theblock;
}
// He looks like this
// [0,0,B,0,0,0,0,0,B,0,0]
// [0,0,0,B,0,0,0,B,0,0,0]
// [0,0,B,B,B,B,B,B,B,0,0]
// [0,B,B,0,B,B,B,0,B,B,0]
// [B,B,B,B,B,B,B,B,B,B,B]
// [B,0,B,B,B,B,B,B,B,0,B]
// [B,0,B,0,0,0,0,0,B,0,B]
// [0,0,0,B,B,0,B,B,0,0,0]
this.chkpt('invader-start');
this.up(9)
.boxa([0,0,B,0,0,0,0,0,B,0,0], 11, 1, 1).down(1)
.boxa([0,0,0,B,0,0,0,B,0,0,0], 11, 1, 1).down(1)
.boxa([0,0,B,B,B,B,B,B,B,0,0], 11, 1, 1).down(1)
.boxa([0,B,B,0,B,B,B,0,B,B,0], 11, 1, 1).down(1)
.boxa([B,B,B,B,B,B,B,B,B,B,B], 11, 1, 1).down(1)
.boxa([B,0,B,B,B,B,B,B,B,0,B], 11, 1, 1).down(1)
.boxa([B,0,B,0,0,0,0,0,B,0,B], 11, 1, 1).down(1)
.boxa([0,0,0,B,B,0,B,B,0,0,0], 11, 1, 1).down(1);
return this.move('invader-start');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment