-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
323 lines (229 loc) · 7.23 KB
/
main.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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
--[[
Wireless Delivery
The most bland gamejam entry ever!
Coded by Lokachop, 2023
powered by a lack of social interaction and that one paracetamol i took while making the map editor
the codebase for this is horrendous, sorry in advance
mystery global variables, magic global funcs, weird casing, etc...
hello again
it is 23 hr till i have to submit game and i only have 5 maps :c
ok my goal is to ship with 8 maps, i quickly threw together another one so i only need to make 2 maps
am running out of ideas for creative uses of the connection concept though
and i still need to make the trailer and the promoart
and the final cleanup....
ok so map ideas
map7; yet another vertical map but you go up to turn on signal below "Vertical Signal"
map8; the final one so itwill be complex; you have to do first a map4 type of thing of going to the left to turn on signal, then u go up to turn on other signal
and then u go to right to win and beat game
alr time to CODEE
hiii
20 hr till submit time
i got the 8 maps fully done and everything looks ready to go so ill quickly throw together a shit song for the credits and ill start cleaning up
good news 19 hr left till submit and i wrote a song :D
(test3.wav) i think ill call it trash.mp3
its in the game
i wish i could fix the laggy buttons but no time
gonna make clean up and upload
]]
ConnJam = ConnJam or {}
TILE_SIZE = 64
PLAYER_SIZE_X = 48
PLAYER_SIZE_Y = 48
PLAYER_SPEEDCAP = 400
CONNECTION_RANGE = 1024 * 24
CANVAS_MAIN = nil
STATE_MENU = 0
STATE_MAPEDIT = 1
STATE_PLAY = 2
STATE_CREDITS = 3
STATE_LEVELEND = 4
STATE_FAIL = 5
GAME_STATE = STATE_MENU
function love.load() -- called on start
love.filesystem.load("/initlua.lua")()
Curtime = 0
love.keyboard.setKeyRepeat(true)
CANVAS_MAIN = love.graphics.newCanvas(love.graphics.getDimensions())
CANVAS_BLUR = love.graphics.newCanvas(love.graphics.getDimensions())
if GAME_STATE == STATE_MENU then
ConnJam.InitMainMenu()
end
--ConnJam.LoadMap("level8")
--atlas_img = love.graphics.newImage(ConnJam.TexAtlas)
end
function love.update(dt)
Curtime = Curtime + dt
ConnJam.Player.anim_time = ConnJam.Player.anim_time + dt
RealFPS = 1 / dt
if GAME_STATE == STATE_PLAY then
ConnJam.HandlePlayerTileTouch()
ConnJam.MovePlayer(dt)
ConnJam.UpdatePlayer(dt)
ConnJam.CameraSeekPlayer(dt)
ConnJam.UpdateConnectivity(dt)
ConnJam.UpdateTimer(dt)
ConnJam.DistortSongThink()
end
if GAME_STATE == STATE_LEVELEND then
ConnJam.CameraSeekPlayer(dt)
end
if GAME_STATE == STATE_FAIL then
ConnJam.CameraSeekPlayer(dt)
end
if GAME_STATE == STATE_MAPEDIT then
MapEdit.MoveMapEditor(dt)
end
if GAME_STATE == STATE_MENU then
ConnJam.UpdateCameraMainMenu(dt)
ConnJam.MenuThink(dt)
end
if GAME_STATE == STATE_CREDITS then
ConnJam.CreditsThink(dt)
end
lsglil2.Update(dt)
end
function love.textinput(t)
local cancel = lsglil2.UpdateTextEntry(t)
if cancel then
return
end
end
function love.keypressed(key, scancode, isrepeat)
local cancel lsglil2.UpdateTextEntryKeyPress(key)
if cancel then
return
end
if GAME_STATE == STATE_MAPEDIT then
MapEdit.EditorKeybinds(key, scancode, isrepeat)
end
end
function love.mousepressed(x, y, button, istouch, presses)
if GAME_STATE == STATE_MAPEDIT then
MapEdit.EditorMouse(x, y, button, istouch, presses)
end
end
function love.draw() -- draw
local w, h = love.graphics.getDimensions()
love.graphics.setCanvas(CANVAS_MAIN)
love.graphics.setBlendMode("alpha")
if GAME_STATE == STATE_PLAY then
love.graphics.clear(.5, .5, 1, 1)
love.graphics.push()
ConnJam.TranslateScaleCamera()
ConnJam.RenderParallaxBackground()
ConnJam.RenderMapBackground()
ConnJam.RenderPlayer()
--ConnJam.DebugDrawTraces()
ConnJam.RenderMap()
ConnJam.RenderMapEx()
love.graphics.pop()
end
if GAME_STATE == STATE_LEVELEND then
love.graphics.clear(.5, .5, 1, 1)
love.graphics.push()
ConnJam.TranslateScaleCamera()
ConnJam.RenderParallaxBackground()
ConnJam.RenderMapBackground()
ConnJam.RenderPlayer()
ConnJam.RenderMap()
ConnJam.RenderMapEx()
love.graphics.pop()
end
if GAME_STATE == STATE_FAIL then
love.graphics.clear(.5, .5, 1, 1)
love.graphics.push()
ConnJam.TranslateScaleCamera()
ConnJam.RenderParallaxBackground()
ConnJam.RenderMapBackground()
ConnJam.RenderPlayer()
ConnJam.RenderMap()
ConnJam.RenderMapEx()
love.graphics.pop()
end
if GAME_STATE == STATE_MAPEDIT then
love.graphics.clear(.5, .5, 1, 1)
love.graphics.push()
ConnJam.TranslateScaleCamera()
ConnJam.RenderParallaxBackground()
love.graphics.setColor(1, 1, 1, 1)
MapEdit.RenderMapUnefficient()
MapEdit.RenderCursor()
ConnJam.RenderMapEx()
love.graphics.pop()
end
if GAME_STATE == STATE_MENU then
love.graphics.clear(.5, .5, 1, 1)
love.graphics.push()
ConnJam.TranslateScaleCamera()
ConnJam.RenderParallaxBackground()
ConnJam.RenderMapBackground()
ConnJam.RenderMap()
love.graphics.pop()
end
love.graphics.setCanvas()
if GAME_STATE == STATE_PLAY then
Shaders["noise.frag"]:send("randseed", math.random())
love.graphics.setShader(Shaders["noise.frag"])
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setBlendMode("alpha", "premultiplied")
love.graphics.draw(CANVAS_MAIN, 0, 0)
love.graphics.setBlendMode("alpha")
love.graphics.setShader()
ConnJam.RenderTimer()
end
if GAME_STATE == STATE_LEVELEND then
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setBlendMode("alpha", "premultiplied")
love.graphics.draw(CANVAS_MAIN, 0, 0)
love.graphics.setBlendMode("alpha")
love.graphics.setColor(0, 0, 0, .55)
love.graphics.rectangle("fill", 0, 0, w, h)
ConnJam.RenderLevelEnd()
end
if GAME_STATE == STATE_FAIL then
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setBlendMode("alpha", "premultiplied")
love.graphics.draw(CANVAS_MAIN, 0, 0)
love.graphics.setBlendMode("alpha")
love.graphics.setColor(0, 0, 0, .55)
love.graphics.rectangle("fill", 0, 0, w, h)
ConnJam.RenderLevelFail()
end
if GAME_STATE == STATE_MENU then
love.graphics.setShader(Shaders["blur.frag"])
love.graphics.setBlendMode("alpha")
love.graphics.setColor(1, 1, 1, 1)
for i = 1, 6 do
Shaders["blur.frag"]:send("add", i / 512)
local rot = (i % 2) == 0
love.graphics.setCanvas(rot and CANVAS_MAIN or CANVAS_BLUR)
love.graphics.draw(rot and CANVAS_BLUR or CANVAS_MAIN, 0, 0)
love.graphics.setCanvas()
end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setBlendMode("alpha", "premultiplied")
local w_mul = (w + 64) / w
local h_mul = (h + 64) / h
love.graphics.draw(CANVAS_MAIN, -32, -32, 0, w_mul, h_mul)
love.graphics.setBlendMode("alpha")
love.graphics.setShader()
end
if GAME_STATE == STATE_MAPEDIT then
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setBlendMode("alpha", "premultiplied")
love.graphics.draw(CANVAS_MAIN, 0, 0)
love.graphics.setBlendMode("alpha")
MapEdit.RenderInfo()
MapEdit.DrawTilePalette()
end
if GAME_STATE == STATE_MENU then
love.graphics.setColor(0, 0, 0, .6)
love.graphics.rectangle("fill", 0, 0, w, h)
love.graphics.setColor(1, 1, 1, 1)
ConnJam.RenderMainMenuIcon()
end
if GAME_STATE == STATE_CREDITS then
ConnJam.RenderCredits()
end
lsglil2.DrawElements()
end