-
Notifications
You must be signed in to change notification settings - Fork 380
/
temple.js
55 lines (44 loc) · 1.12 KB
/
temple.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
/*global require*/
var Drone = require('drone'),
blocks = require('blocks');
/************************************************************************
### Drone.temple() method
Constructs a mayan temple.
#### Parameters
* side - How many blocks wide and long the temple will be (default: 20)
#### Example
At the in-game prompt you can create a temple by looking at a block and typing:
```javascript
/js temple()
```
Alternatively you can create a new Drone object from a Player or Location object and call the temple() method.
```javascript
var d = new Drone(player);
d.temple();
```
![temple example](img/templeex1.png)
***/
function temple( side ) {
if ( !side ) {
side = 20;
}
this.chkpt('temple');
while ( side > 4 ) {
var middle = Math.round( (side-2) / 2 );
this
.chkpt('temple-corner')
.box( blocks.brick.mossy, side, 1, side )
.right( middle )
.box( blocks.stairs.stone )
.right()
.box( blocks.stairs.stone )
.move('temple-corner')
.up()
.fwd()
.right();
side = side - 2;
}
this.move('temple');
}
Drone.extend( temple );