ca0e8212
Geoffrey PREUD'HOMME
Code original
|
1
|
function menu_load()
|
1dc2cce5
Geoffrey PREUD'HOMME
Jeu redémarre
|
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
|
imagelist = {"title", "cloud1", "cloud2", "ground", "bush1", "bush2", "powerup", "rocket", "star", "asteroid-big1", "sunglasses", "awesome", "arrow", "groundwin",
"asteroid-big2", "asteroid-small1", "asteroid-small2", "bullet", "littleexplosion", "warning", "wheatley", "alert", "randomshit", "bird"}
for i = 1, #imagelist do
_G[imagelist[i] .. "img"] = love.graphics.newImage("graphics/" .. imagelist[i] .. ".png")
end
fontimage = love.graphics.newImage("graphics/font.png")
fontglyphs = "0123456789abcdefghijklmnopqrstuvwxyz.:/,'C-_>* !{}?"
fontquads = {}
for i = 1, string.len(fontglyphs) do
fontquads[string.sub(fontglyphs, i, i)] = love.graphics.newQuad((i-1)*8, 0, 8, 8, 408, 8)
end
playerimg = love.graphics.newImage("graphics/trosh.png")
playerquad = {love.graphics.newQuad(0, 0, 14, 25, 54, 25), love.graphics.newQuad(14, 0, 14, 25, 54, 25), love.graphics.newQuad(28, 0, 26, 12, 54, 25), love.graphics.newQuad(28, 12, 26, 12, 54, 25)}
winplayerimg = love.graphics.newImage("graphics/troshwin.png")
winplayerquad = {}
for x = 1, 4 do
winplayerquad[x] = love.graphics.newQuad((x-1)*11, 0, 11, 26, 44, 26)
end
enemyimg = love.graphics.newImage("graphics/enemy.png")
enemyquad = {}
for y = 1, 4 do
for x = 1, 4 do
enemyquad[(y-1)*4+x] = love.graphics.newQuad((x-1)*100, (y-1)*96, 100, 96, 400, 384)
end
end
explosionimg = love.graphics.newImage("graphics/explosion.png")
explosionquad = {}
for y = 1, 5 do
for x = 1, 5 do
explosionquad[(y-1)*5+x] = love.graphics.newQuad((x-1)*66, (y-1)*81, 66, 81, 330, 405)
end
end
bigexplosionimg = love.graphics.newImage("graphics/bigexplosion.png")
bigexplosionquad = {}
for y = 1, 5 do
for x = 1, 5 do
bigexplosionquad[(y-1)*5+x] = love.graphics.newQuad((x-1)*108, (y-1)*121, 108, 121, 540, 605)
end
end
splatterimg = love.graphics.newImage("graphics/splatter.png")
splatterquad = {}
for x = 1, 6 do
splatterquad[x] = love.graphics.newQuad((x-1)*64, 0, 64, 64, 384, 64)
end
birdquad = {love.graphics.newQuad(0, 0, 29, 16, 29, 32), love.graphics.newQuad(0, 16, 29, 16, 29, 32)}
|
baf8a5f5
Geoffrey PREUD'HOMME
Kiosk ready
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
if arg[3] then
scale = arg[3]
else
scale = 8
end
if arg[4] then
fullscreen = true
else
fullscreen = false
end
if not windowSet then
love.graphics.setMode(100*scale, 80*scale, fullscreen, true, 0)
windowSet = true
end
|
1dc2cce5
Geoffrey PREUD'HOMME
Jeu redémarre
|
73
74
75
76
|
love.graphics.setIcon( love.graphics.newImage("graphics/icon.png") )
bgmusic = love.audio.newSource("audio/trosong.ogg")
bgmusic:setLooping(true)
|
baf8a5f5
Geoffrey PREUD'HOMME
Kiosk ready
|
77
|
bgmusic:setVolume(0)
|
1dc2cce5
Geoffrey PREUD'HOMME
Jeu redémarre
|
78
79
80
81
82
83
84
85
86
87
88
89
|
lasersound = love.audio.newSource("audio/laser.wav")
bigexplosionsound = love.audio.newSource("audio/bigexplosion.ogg")
explosionsound = love.audio.newSource("audio/explosion.wav")
launchsound = love.audio.newSource("audio/launch.ogg")
gunfire = love.audio.newSource("audio/gunfire.wav")
space = love.audio.newSource("audio/space.ogg")
sunglassessound = love.audio.newSource("audio/sunglasses.ogg")
splat = love.audio.newSource("audio/splat.ogg")
ding = love.audio.newSource("audio/ding.ogg")
credits = love.audio.newSource("audio/credits.ogg")
approach = love.audio.newSource("audio/approach.ogg")
credits:setLooping(true)
|
baf8a5f5
Geoffrey PREUD'HOMME
Kiosk ready
|
90
|
credits:setVolume(0)
|
1dc2cce5
Geoffrey PREUD'HOMME
Jeu redémarre
|
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
|
skipupdate = true
shakeamount = 0
shake = 0
fade = 0
playerframe = 1
scoreanim = 1
rainbowi = 0.5
sini = 0
sini2 = math.pi/2
scrollx = 0
points = 0
machinedelay = 0.05
stars = {}
explosions = {}
backgroundstripes = 10
sunrot = 0
lasers = {}
realasteroiddelay = 1
movement1speed = 100
laserdelay = 0
reallaserdelay = 0.4
starttimer = 0
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
117
118
|
pseudo = ""
|
1dc2cce5
Geoffrey PREUD'HOMME
Jeu redémarre
|
119
120
121
122
123
124
|
rockets = nil
jumped = nil
landing = nil
sunglasses = nil
massenemies = nil
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
125
126
127
|
love.graphics.setBackgroundColor(153, 217, 234)
clouds = {}
bushes = {}
|
baf8a5f5
Geoffrey PREUD'HOMME
Kiosk ready
|
128
|
love.audio.play(bgmusic)
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
for i = 1, 5 do
table.insert(clouds, cloud:new(true))
end
for i = 1, 30 do
table.insert(bushes, bush:new(true))
end
textpos = {}
for i = 0, 7 do
textpos[i] = 10
end
playerframetimer = 0
playery = 50
playerx = 10
-- 1 2 3 4 5 6 7
startactions = {2.3, 4.6, 7, 8.20, 9.20, 10.20, 11.20}
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
145
|
starti = -1
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
end
function menu_update(dt)
for i, v in pairs(clouds) do
v:update(dt)
end
for i, v in pairs(bushes) do
v:update(dt)
end
scrollx = scrollx + dt*50
rainbowi = math.mod(rainbowi + dt/2, 1)
sini = math.mod(sini + dt*10, math.pi*2)
sini2 = math.mod(sini2 + dt*5, math.pi*2)
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
163
|
if starti >= 0 and starttimer > startactions[starti+1] then
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
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
|
starti = starti+1
if starti == 7 then
changegamestate("scene1")
return
end
end
if starti >= 4 then
shakeamount = shakeamount + dt*4
end
if starti >= 5 then
shakeamount = shakeamount + dt*10
end
if starti >= 6 then
shakeamount = shakeamount + dt*50
end
for i = -1, starti-1 do
if i >= 0 then
textpos[i] = textpos[i]+(textpos[i]^2*dt)
end
end
playerframetimer = playerframetimer + dt*10
while playerframetimer >= 2 do
playerframetimer = playerframetimer - 2
end
playerframe = math.floor(playerframetimer)+1
playermovement1(dt)
end
function menu_action()
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
197
198
199
|
if starti >= 0 then
shootlaser()
end
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
end
function menu_draw()
love.graphics.setColor(255, 255, 255)
for i, v in pairs(clouds) do
v:draw()
end
for i = 1, 2 do
draw(groundimg, -math.mod(scrollx, 120) + (i-1)*120, 59)
end
for i, v in pairs(bushes) do
v:draw()
end
love.graphics.drawq(playerimg, playerquad[playerframe], playerx*scale, playery*scale, 0, scale, scale, 7, 12)
for i, v in pairs(lasers) do
v:draw()
end
love.graphics.setColor(getrainbowcolor(rainbowi, 420))
draw(titleimg, 50, 23, math.sin(sini)/10, (math.sin(sini2)+1)/5+0.7, (math.sin(sini2)+1)/5+0.7, 50, 13)
love.graphics.setColor(255, 0, 0)
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
224
|
if starti >= -1 then
|
48449675
Geoffrey PREUD'HOMME
Améliorations
|
225
|
properprint("tape ton pseudo", 18, 40+textpos[0], scale/2)
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
226
227
228
229
230
231
|
properprint(pseudo, 20, 50+textpos[0], scale/2)
end
-- if starti >= 0 then
-- properprint("directed by maurice", 13, 40+textpos[0], scale/2)
-- end
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
232
|
if starti >= 1 then
|
97da6ed3
Geoffrey PREUD'HOMME
Menu en français
|
233
|
properprint("utilise les fleches", 11, 40+textpos[1], scale/2)
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
234
235
|
end
if starti >= 2 then
|
48449675
Geoffrey PREUD'HOMME
Améliorations
|
236
|
properprint("et une autre touche", 11, 40+textpos[2], scale/2)
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
237
238
|
end
if starti >= 3 then
|
97da6ed3
Geoffrey PREUD'HOMME
Menu en français
|
239
|
properprint("pret...", 30, 40+textpos[3], scale/2)
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
240
241
242
243
244
245
246
247
248
249
250
|
end
if starti >= 4 then
properprint("3", 40, 40+textpos[4], scale*2)
end
if starti >= 5 then
properprint("2", 36, 40+textpos[5], scale*3)
end
if starti >= 6 then
properprint("1", 32, 40+textpos[6], scale*4)
end
if starti >= 7 then
|
97da6ed3
Geoffrey PREUD'HOMME
Menu en français
|
251
|
properprint("go !", 10, 40+textpos[7], scale*6)
|
ca0e8212
Geoffrey PREUD'HOMME
Code original
|
252
253
254
255
|
end
love.graphics.setColor(255, 255, 255)
end
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
256
257
|
function menu_keypressed(key, unicode)
|
8ba25957
Geoffrey PREUD'HOMME
pseudo
|
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
if starti == -1 then
if string.len(pseudo) < 16 then
if string.sub(key, 1, 2) == 'kp' then
key = string.sub(key, 3, 3)
end
if string.len(key) == 1 and string.find(fontglyphs, key, 1, true) then
pseudo = pseudo .. key
end
end
if key == 'backspace' then
pseudo = string.sub(pseudo, 1, -2)
end
if key == 'return' and string.len(pseudo) > 3 then
starttimer = startactions[1]
starti = 1
end
end
end
|