-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.lua
276 lines (195 loc) · 7.03 KB
/
screen.lua
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
screen = {}
SCREENSIZEX = 128;
SCREENSIZEY = 128;
SCREENSCALE = 4;
FILTERMODE = "nearest";
function screen.load()
screen.size = { x = SCREENSIZEX, y = SCREENSIZEY }
screen.scale = SCREENSCALE
love.window.setTitle("d-junglee")
-- love.window.setMode(screen.size.x * screen.scale, screen.size.y * screen.scale, {borderless = false, display = 2})
love.window.setMode(screen.size.x * screen.scale, screen.size.y * screen.scale, {borderless = true})
love.graphics.setDefaultFilter(FILTERMODE, FILTERMODE)
love.graphics.setLineStyle('rough')
love.mouse.setVisible(false)
screen.canvas = love.graphics.newCanvas(SCREENSIZEX, SCREENSIZEY)
screen.tip = {
show = true,
help = true,
text = "Вернитесь в лабо-\nраторию, сектор F5"
}
screen.header = "Рассвет"
screen.text = "Вы проснулись в открытой пещере. Невдалеке виднеется песчаный пляж и слышно гул чаек.\n\nВы набрели на эту пещеру ещё вчера, и уснули здесь наблюдая за прекрасным видом.\n\nПора возвращаться обратно."
screen.state = game.state
screen.time = time
screen.key = 0
end
function screen.draw()
-- ПЕРЕХОД МЕЖДУ ЭКРАНАМИ В ВИДЕ ЧЕРНОГО КАДРА
-- if screen.time <= 0.1 then
-- return
-- end
screen[screen.state]() -- Запуск функции соответствующей состоянию экрана
end
-- Update
function screen.update(dt)
screen.time = screen.time + dt
if screen.state == "intro" and screen.time > 8 then
game.logo()
end
if screen.state == "logo" and screen.time > 3 then
game.title()
end
end
function screen.font()
love.graphics.setColor(hsv(screen.time % 2 * 127.5, 255, 255))
love.graphics.setFont(font.monobold)
-- color.reset()
love.graphics.printf("!\"#$%&`()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя█▒~", 0, 0, 128)
end
-- Intro
function screen.intro()
color.reset()
love.graphics.printf({{1, 0, 0}, "ВНИМАНИЕ!"}, 8, 12, 112, "center")
s = {
rgba(244, 244, 244, 1),
"Не ожидайте прекрасного.\n\nВаш монитор\nне способен отобразить даже половины цветов нашего мира."
}
love.graphics.printf(s, 12, 28, 112, "left")
love.graphics.printf({{255/255, 171/255, 0/255}, "@a0405u"}, 8, 108, 112, "right")
-- love.graphics.setColor(49/255, 105/255, 82/255)
-- love.graphics.setLineWidth(2)
-- love.graphics.rectangle("line", 1, 1, 126, 126)
-- color.reset()
end
-- Logo
function screen.logo()
love.graphics.draw(sprite.screen.logo)
end
-- Title
function screen.title()
color.reset()
love.graphics.draw(sprite.screen.title)
if screen.time % 2 > 1 then
love.graphics.setColor(color.white)
love.graphics.printf("Нажми START", 0, 89, 128, "center")
end
end
function screen.drawtip()
love.graphics.setColor(color.black)
love.graphics.rectangle("fill", 23, 39, 81, 33)
color.reset()
if screen.tip.help == true then
love.graphics.printf({color.light, "Скрыть - TAB"}, font.small, 26, 62, 75, "center")
end
love.graphics.printf({color.white, screen.tip.text}, font.small, 26, 42, 75, "center")
end
-- Map
function screen.map()
-- map.draw()
-- map.drawgrid()
-- map.drawframe()
map.draw()
player.draw()
for i = 1, #monsters do
monsters[i]:draw(dt)
end
for i = 1, #pickups do
pickups[i]:draw(dt)
end
fog.draw()
clock.draw()
if screen.tip.show == true then
screen.drawtip()
end
-- sight.draw();
end
function screen.file()
love.graphics.draw(sprite.screen.file)
love.graphics.draw(player.portrait, 8, 8)
love.graphics.printf({color.white, "Антон\nЛисицин"}, 48, 8, 72)
love.graphics.printf({color.light, "Уборщик"}, 48, 32, 72)
love.graphics.setFont(font.small)
love.graphics.printf({color.white, "Дальнегорск. 19 Апреля, 1976. \n", color.light, "Необщительный, закрытый че-\nловек. Честный, ответственный работник. Замечено нарушение режима содержания.\n\n", color.white, "Уровень доступа:\n", color.light, "- Омега-8"}, 8, 49, 112)
love.graphics.setFont(font.default)
end
-- Info
function screen.info()
if cycle.state == "day" then
love.graphics.clear(color.black)
love.graphics.setColor(color.white)
else
love.graphics.clear(color.black)
love.graphics.setColor(color.white)
end
love.graphics.printf(screen.header, font.default, 8, 8, 112, "left")
love.graphics.printf(screen.text, font.small, 8, 24, 112, "left")
choice.draw()
end
-- Terminal
function screen.terminal()
terminal.draw()
end
-- Death
function screen.death()
color.reset()
love.graphics.printf({{1, 0, 0}, "ПОПРОБУЙ ЕЩЁ\n\n"}, 0, 60, 128, "center")
end
function screen.ending()
if screen.key < 4 then
screen.map()
else
love.graphics.draw(sprite.screen.ghost)
if screen.time <=1.45 then
love.graphics.draw(sprite.screen.off[1])
elseif screen.time <=1.6 then
love.graphics.draw(sprite.screen.off[2])
end
end
if screen.key < 1 then
sound.play(sound.shot)
screen.key = 1
end
if screen.time <= 0.1 and screen.key < 2 then
love.graphics.setColor(color.white)
love.graphics.draw(sprite.screen.noise)
end
if screen.time >= 0.6 and screen.key < 2 then
sound.play(sound.shot)
screen.key = 2
end
if screen.time <= 0.7 and screen.key > 1 then
love.graphics.setColor(color.white)
love.graphics.draw(sprite.screen.noise)
end
if screen.time >= 1.2 and screen.key < 3 then
sound.play(sound.shot)
screen.key = 3
end
if screen.time <= 1.3 and screen.key > 2 then
love.graphics.setColor(color.white)
love.graphics.draw(sprite.screen.noise)
end
if screen.time >= 1.4 and screen.key < 4 then
sound.play(sound.last)
screen.key = 4
end
if screen.time <= 1.5 and screen.key > 3 then
love.graphics.setColor(color.white)
love.graphics.draw(sprite.screen.noise)
end
if screen.key > 1 then
color.reset()
love.graphics.draw(sprite.screen.blood[1])
end
if screen.key > 2 then
color.reset()
love.graphics.draw(sprite.screen.blood[2])
end
end
function screen.show(state)
screen.state = state
screen.time = 0
sound.screen:seek(0)
sound.screen:play()
end