SHOW:
|
|
- or go back to the newest paste.
1 | - | os.loadAPI("static") |
1 | + | function static() |
2 | term.clear() | |
3 | - | function hole() |
3 | + | |
4 | x,y = term.getSize() | |
5 | - | middley = y/2 |
5 | + | |
6 | - | middlex = x/2 |
6 | + | |
7 | - | holesize = 1 |
7 | + | for i=1,x do |
8 | posx = i | |
9 | - | term.setCursorPos(middlex - holesize,middley + holesize) |
9 | + | |
10 | for i=1,y do | |
11 | - | write("/") |
11 | + | posy = i |
12 | - | for i=1,holesize do |
12 | + | chance = math.random(0,1) |
13 | - | write("-") |
13 | + | if chance == 1 then |
14 | term.setCursorPos(posx,posy) | |
15 | - | print("\\") |
15 | + | write("#") |
16 | end | |
17 | - | prog = 0 |
17 | + | |
18 | - | for i=1,holesize do |
18 | + | |
19 | - | setCursorPos(middlex - holesize, middley + holesize - prog) |
19 | + | |
20 | - | write("|") |
20 | + | |
21 | - | for i=1,holesize do |
21 | + | |
22 | - | write(" ") |
22 | + | |
23 | ||
24 | - | write("|") |
24 | + | |
25 | - | prog = prog + 1 |
25 | + | function slowStatic() |
26 | while true do | |
27 | static() | |
28 | sleep(0.75) | |
29 | end | |
30 | - | term.setCursorPos(middlex - holesize,middley - holesize) |
30 | + | |
31 | - | write("/") |
31 | + | |
32 | - | for i=1,holesize do |
32 | + | function fastStatic() |
33 | - | write("-") |
33 | + | |
34 | static() | |
35 | - | print("\\") |
35 | + | |
36 | end | |
37 | end | |
38 | ||
39 | ||
40 | - | static.static() |
40 | + | |
41 | term.clear() | |
42 | print("slow or fast?") | |
43 | - | for i=1,10 do |
43 | + | answer = read() |
44 | - | for i=1,20 do |
44 | + | |
45 | - | hole() |
45 | + | |
46 | if answer == "slow" then | |
47 | slowStatic() | |
48 | - | holesize = holesize + 2 |
48 | + | |
49 | - | sleep(2) |
49 | + | |
50 | elseif answer == "fast" then | |
51 | fastStatic() | |
52 | end | |
53 | ||
54 | function otherFastStatic() | |
55 | while true do | |
56 | term.clear() | |
57 | ||
58 | x,y = term.getSize() | |
59 | ||
60 | ||
61 | for i=1,x do | |
62 | posx = i | |
63 | ||
64 | for i=1,y do | |
65 | posy = i | |
66 | chance = math.random(0,1) | |
67 | if chance == 1 then | |
68 | term.setCursorPos(posx,posy) | |
69 | write("#") | |
70 | end | |
71 | ||
72 | end | |
73 | end | |
74 | sleep(0.02) | |
75 | end | |
76 | end |