-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsheeprain.js
More file actions
59 lines (48 loc) · 1.56 KB
/
sheeprain.js
File metadata and controls
59 lines (48 loc) · 1.56 KB
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
56
57
58
59
//makes it rain flaming sheep
var countsheep = 0;
var thisdrone;
function sheeprain(params, player){
//set up the drone, raise it up 40 blocks, and set a checkpoint
thisdrone = new Drone(player.location);
thisdrone.up(40);
thisdrone.chkpt('first');
//set a randomly long time between sheep and call the dropper
tov = setTimeout(dropper, intervaler());
}
function dropper(){
//control function
countsheep++;
//move the drone to the checkpoint 40 blocks above you
thisdrone.move('first');
//move the drone to a random location within 13 blocks
mover();
//create the sheep and set it on fire
var sheep = dospawn('sheep',thisdrone.getLocation());
sheep.setFireTicks(500);
//set a randomly long time to wait and then another sheep
if(countsheep < 300) tov = setTimeout(dropper, intervaler());
}
function mover(){
//generate random movement and turn values
var turn = Math.round(Math.random() * 3);
var left = genXY();
var fwd = genXY();
//apply the random movement and turn values to the drone
thisdrone.turn(turn);
thisdrone.left(left);
thisdrone.fwd(fwd);
}
function genXY(){
var limit = 25;
//returns a random integer between -limit and limit
var isneg = Math.round(Math.random() * 1);
var move = Math.floor(Math.random() * limit);
if(isneg === 1) move = move * -1;
return move;
}
function intervaler(){
//sets the value of the random interval between sheep
var interval = Math.floor(Math.random() * 200);
return interval;
}
command( sheeprain );