-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnyamCat.lua
More file actions
222 lines (171 loc) · 5.98 KB
/
Copy pathnyamCat.lua
File metadata and controls
222 lines (171 loc) · 5.98 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
-- © Marcel Märtens, Germany 2012
-- Please do not remove this hint. Thank you.
-- Exile-Tek thanks you for this code!
-- Diese Datei steht unter der Creative Commons Lizenz für Namensnennung-Weitergabe unter gleichen Bedingungen 3.0 Deutschland (CC BY-SA 3.0)
-- Besuchen sie die folgende Website für weitere Informationen: http://creativecommons.org/licenses/by-sa/3.0/de/
-- website in english http://creativecommons.org/licenses/by-sa/3.0/
-- NyamCat image resized to fit Exile-Tek screens by Jabulba
term.clear()
term.setCursorPos(1,1)
--while true do mTask.RunFile("/marcelOS/programs/vlc","/examples/evlc2") end
local star = {}
star.__index = star
local minX = 1
local maxX = 10
local monWidth, monHeight = term.getSize()
function star.create()
local acnt = {}
setmetatable(acnt,star)
mx = math.floor(monWidth+2)
my = math.floor(math.random(1,monHeight))
acnt.x = mx
acnt.y = my
acnt.speed = math.floor(math.random(1,4))
acnt.pos =math.floor(math.random(minX,maxX))
return acnt
end
function rawWriteLoc(x,y,sText)
term.setCursorPos(x,y)
term.write(sText)
end
function star:clear()
if self.pos == 1 then
rawWriteLoc(self.x,self.y," ")
elseif (self.pos == 2) or (self.pos == 3) or (self.pos == 4) or (self.pos == 8) or (self.pos == 9) or (self.pos == 10) then
rawWriteLoc(self.x-1,self.y-1," ")
rawWriteLoc(self.x-1,self.y, " ")
rawWriteLoc(self.x-1,self.y+1," ")
elseif (self.pos == 5) or (self.pos == 6) or (self.pos == 7) then
rawWriteLoc(self.x-2,self.y-2," ")
rawWriteLoc(self.x-2,self.y-1," ")
rawWriteLoc(self.x-2,self.y, " ")
rawWriteLoc(self.x-2,self.y+1," ")
rawWriteLoc(self.x-2,self.y+2," ")
end
end
function star:draw()
if self.pos == 1 then
rawWriteLoc(self.x,self.y,"+")
elseif self.pos == 2 then
rawWriteLoc(self.x-1,self.y-1," | ")
rawWriteLoc(self.x-1,self.y, "-+-")
rawWriteLoc(self.x-1,self.y+1," | ")
elseif self.pos == 3 then
rawWriteLoc(self.x-1,self.y-1," | ")
rawWriteLoc(self.x-1,self.y, "- -")
rawWriteLoc(self.x-1,self.y+1," | ")
elseif self.pos == 4 then
rawWriteLoc(self.x-1,self.y-1,"/-\\")
rawWriteLoc(self.x-1,self.y, "| |")
rawWriteLoc(self.x-1,self.y+1,"\\-/")
elseif self.pos == 5 then
rawWriteLoc(self.x-2,self.y-2," | ")
rawWriteLoc(self.x-2,self.y-1," / \\ ")
rawWriteLoc(self.x-2,self.y, "- -")
rawWriteLoc(self.x-2,self.y+1," \\ / ")
rawWriteLoc(self.x-2,self.y+2," | ")
elseif self.pos == 6 then
rawWriteLoc(self.x-2,self.y-2," /-\\ ")
rawWriteLoc(self.x-2,self.y-1,"/ \\")
rawWriteLoc(self.x-2,self.y, "| |")
rawWriteLoc(self.x-2,self.y+1,"\\ /")
rawWriteLoc(self.x-2,self.y+2," \\-/ ")
elseif self.pos == 7 then
rawWriteLoc(self.x-2,self.y-2," | ")
rawWriteLoc(self.x-2,self.y-1," / \\ ")
rawWriteLoc(self.x-2,self.y, "- -")
rawWriteLoc(self.x-2,self.y+1," \\ / ")
rawWriteLoc(self.x-2,self.y+2," | ")
elseif self.pos == 8 then
rawWriteLoc(self.x-1,self.y-1,"/-\\")
rawWriteLoc(self.x-1,self.y, "| |")
rawWriteLoc(self.x-1,self.y+1,"\\-/")
elseif self.pos == 9 then
rawWriteLoc(self.x-1,self.y-1," | ")
rawWriteLoc(self.x-1,self.y, "- -")
rawWriteLoc(self.x-1,self.y+1," | ")
elseif self.pos == 10 then
rawWriteLoc(self.x-1,self.y-1," | ")
rawWriteLoc(self.x-1,self.y, "-+-")
rawWriteLoc(self.x-1,self.y+1," | ")
end
end
function star:move()
self.x = self.x - self.speed
return self.x > -4
end
function Addstar()
local new = star.create()
local x = #star+1
star[x] = new
return new,x
end
function RenderStar()
local i,w = 1
for i,w in ipairs(star) do
w:draw()
end
end
function MoveStar()
local i,w = 1
for i,w in ipairs(star) do
w:clear()
if (math.random(1,6) < 4) then
w.pos = w.pos +1
if w.pos > maxX then w.pos = minX end
end
if not w:move() then
star[i] = star[#star]
star[#star] = nil
end
end
end
local catnr = 1
local catmax = 6
local catmin = 1
local catx = 0
local caty = math.floor((monHeight-4)/2)
function DrawCat()
if catnr == 1 then
rawWriteLoc(catx,caty, "--.__.--.__.--.__.--.__.--.__.--,------, ")
rawWriteLoc(catx,caty+1,"--.__.--.__.--.__.--.__.--.__.--| /\\_/\\ ")
rawWriteLoc(catx,caty+2,"--.__.--.__.--.__.--.__.--.__.-~|__( ^ .^)")
rawWriteLoc(catx,caty+3,"--.__.--.__.--.__.--.__.--.__.--\"\" \"\" ")
elseif catnr == 2 then
rawWriteLoc(catx,caty, "-.__.--.__.--.__.--.__.--.__.--.,------, ")
rawWriteLoc(catx,caty+1,"-.__.--.__.--.__.--.__.--.__.--.| /\\_/\\ ")
rawWriteLoc(catx,caty+2,"-.__.--.__.--.__.--.__.--.__.--~|__( ^ .^)")
rawWriteLoc(catx,caty+3,"-.__.--.__.--.__.--.__.--.__.--. \"\" \"\" ")
elseif catnr == 3 then
rawWriteLoc(catx,caty, ".__.--.__.--.__.--.__.--.__.--._,------, ")
rawWriteLoc(catx,caty+1,".__.--.__.--.__.--.__.--.__.--._| /\\_/\\ ")
rawWriteLoc(catx,caty+2,".__.--.__.--.__.--.__.--.__.--.~|__( ^ .^)")
rawWriteLoc(catx,caty+3,".__.--.__.--.__.--.__.--.__.--._ \"\" \"\" ")
elseif catnr == 4 then
rawWriteLoc(catx,caty, "__.--.__.--.__.--.__.--.__.--.__,------, ")
rawWriteLoc(catx,caty+1,"__.--.__.--.__.--.__.--.__.--.__| /\\_/\\ ")
rawWriteLoc(catx,caty+2,"__.--.__.--.__.--.__.--.__.--._~|__( ^ .^)")
rawWriteLoc(catx,caty+3,"__.--.__.--.__.--.__.--.__.--.__ \"\" \"\" ")
elseif catnr == 5 then
rawWriteLoc(catx,caty, "_.--.__.--.__.--.__.--.__.--.__.,------, ")
rawWriteLoc(catx,caty+1,"_.--.__.--.__.--.__.--.__.--.__.| /\\_/\\ ")
rawWriteLoc(catx,caty+2,"_.--.__.--.__.--.__.--.__.--.__~|__( ^ .^)")
rawWriteLoc(catx,caty+3,"_.--.__.--.__.--.__.--.__.--.__.\"\" \"\" ")
elseif catnr == 6 then
rawWriteLoc(catx,caty, ".--.__.--.__.--.__.--.__.--.__.-,------, ")
rawWriteLoc(catx,caty+1,".--.__.--.__.--.__.--.__.--.__.-| /\\_/\\ ")
rawWriteLoc(catx,caty+2,".--.__.--.__.--.__.--.__.--.__.~|__( ^ .^)")
rawWriteLoc(catx,caty+3,".--.__.--.__.--.__.--.__.--.__.-\"\" \"\" ")
end
catnr = catnr + 1
if catnr > catmax then catnr = catmin end
end
while true do
if (math.random(1,6) < 4) then
Addstar()
end
MoveStar()
RenderStar()
DrawCat()
sleep(0.05)
end