Commit 8ba259573c31fe59c53b2139cb1e347e4d2c02e9
1 parent
e704c732
pseudo
Showing
2 changed files
with
45 additions
and
21 deletions
Show diff stats
game/menu.lua
@@ -102,6 +102,8 @@ function menu_load() | @@ -102,6 +102,8 @@ function menu_load() | ||
102 | reallaserdelay = 0.4 | 102 | reallaserdelay = 0.4 |
103 | starttimer = 0 | 103 | starttimer = 0 |
104 | 104 | ||
105 | + pseudo = "" | ||
106 | + | ||
105 | rockets = nil | 107 | rockets = nil |
106 | jumped = nil | 108 | jumped = nil |
107 | landing = nil | 109 | landing = nil |
@@ -111,7 +113,7 @@ function menu_load() | @@ -111,7 +113,7 @@ function menu_load() | ||
111 | love.graphics.setBackgroundColor(153, 217, 234) | 113 | love.graphics.setBackgroundColor(153, 217, 234) |
112 | clouds = {} | 114 | clouds = {} |
113 | bushes = {} | 115 | bushes = {} |
114 | - love.audio.play(bgmusic) | 116 | + -- love.audio.play(bgmusic) |
115 | for i = 1, 5 do | 117 | for i = 1, 5 do |
116 | table.insert(clouds, cloud:new(true)) | 118 | table.insert(clouds, cloud:new(true)) |
117 | end | 119 | end |
@@ -128,7 +130,7 @@ function menu_load() | @@ -128,7 +130,7 @@ function menu_load() | ||
128 | playerx = 10 | 130 | playerx = 10 |
129 | -- 1 2 3 4 5 6 7 | 131 | -- 1 2 3 4 5 6 7 |
130 | startactions = {2.3, 4.6, 7, 8.20, 9.20, 10.20, 11.20} | 132 | startactions = {2.3, 4.6, 7, 8.20, 9.20, 10.20, 11.20} |
131 | - starti = 0 | 133 | + starti = -1 |
132 | 134 | ||
133 | end | 135 | end |
134 | 136 | ||
@@ -146,7 +148,7 @@ function menu_update(dt) | @@ -146,7 +148,7 @@ function menu_update(dt) | ||
146 | sini = math.mod(sini + dt*10, math.pi*2) | 148 | sini = math.mod(sini + dt*10, math.pi*2) |
147 | sini2 = math.mod(sini2 + dt*5, math.pi*2) | 149 | sini2 = math.mod(sini2 + dt*5, math.pi*2) |
148 | 150 | ||
149 | - if starttimer > startactions[starti+1] then | 151 | + if starti >= 0 and starttimer > startactions[starti+1] then |
150 | starti = starti+1 | 152 | starti = starti+1 |
151 | if starti == 7 then | 153 | if starti == 7 then |
152 | changegamestate("scene1") | 154 | changegamestate("scene1") |
@@ -180,7 +182,9 @@ function menu_update(dt) | @@ -180,7 +182,9 @@ function menu_update(dt) | ||
180 | end | 182 | end |
181 | 183 | ||
182 | function menu_action() | 184 | function menu_action() |
183 | - shootlaser() | 185 | + if starti >= 0 then |
186 | + shootlaser() | ||
187 | + end | ||
184 | end | 188 | end |
185 | 189 | ||
186 | function menu_draw() | 190 | function menu_draw() |
@@ -205,9 +209,14 @@ function menu_draw() | @@ -205,9 +209,14 @@ function menu_draw() | ||
205 | draw(titleimg, 50, 23, math.sin(sini)/10, (math.sin(sini2)+1)/5+0.7, (math.sin(sini2)+1)/5+0.7, 50, 13) | 209 | draw(titleimg, 50, 23, math.sin(sini)/10, (math.sin(sini2)+1)/5+0.7, (math.sin(sini2)+1)/5+0.7, 50, 13) |
206 | 210 | ||
207 | love.graphics.setColor(255, 0, 0) | 211 | love.graphics.setColor(255, 0, 0) |
208 | - if starti >= 0 then | ||
209 | - properprint("directed by maurice", 13, 40+textpos[0], scale/2) | ||
210 | - end | 212 | + if starti >= -1 then |
213 | + properprint("tapes ton pseudo", 20, 40+textpos[0], scale/2) | ||
214 | + properprint(pseudo, 20, 50+textpos[0], scale/2) | ||
215 | + end | ||
216 | + | ||
217 | + -- if starti >= 0 then | ||
218 | + -- properprint("directed by maurice", 13, 40+textpos[0], scale/2) | ||
219 | + -- end | ||
211 | if starti >= 1 then | 220 | if starti >= 1 then |
212 | properprint("utilise les fleches", 11, 40+textpos[1], scale/2) | 221 | properprint("utilise les fleches", 11, 40+textpos[1], scale/2) |
213 | end | 222 | end |
@@ -232,3 +241,24 @@ function menu_draw() | @@ -232,3 +241,24 @@ function menu_draw() | ||
232 | 241 | ||
233 | love.graphics.setColor(255, 255, 255) | 242 | love.graphics.setColor(255, 255, 255) |
234 | end | 243 | end |
244 | + | ||
245 | +function menu_keypressed(key, unicode) | ||
246 | + print('key: ' .. key .. ' → ' .. unicode) | ||
247 | + if starti == -1 then | ||
248 | + if string.len(pseudo) < 16 then | ||
249 | + if string.sub(key, 1, 2) == 'kp' then | ||
250 | + key = string.sub(key, 3, 3) | ||
251 | + end | ||
252 | + if string.len(key) == 1 and string.find(fontglyphs, key, 1, true) then | ||
253 | + pseudo = pseudo .. key | ||
254 | + end | ||
255 | + end | ||
256 | + if key == 'backspace' then | ||
257 | + pseudo = string.sub(pseudo, 1, -2) | ||
258 | + end | ||
259 | + if key == 'return' and string.len(pseudo) > 3 then | ||
260 | + starttimer = startactions[1] | ||
261 | + starti = 1 | ||
262 | + end | ||
263 | + end | ||
264 | +end |
game/scene6.lua
@@ -30,6 +30,7 @@ function scene6_load() | @@ -30,6 +30,7 @@ function scene6_load() | ||
30 | landdiff = playerx-landingx | 30 | landdiff = playerx-landingx |
31 | 31 | ||
32 | scoremul = round((1-math.abs(landdiff)/80)^8*4, 1) + 1 | 32 | scoremul = round((1-math.abs(landdiff)/80)^8*4, 1) + 1 |
33 | + scoretot = math.ceil(points*scoremul) | ||
33 | 34 | ||
34 | stars = {} | 35 | stars = {} |
35 | 36 | ||
@@ -41,7 +42,7 @@ function scene6_load() | @@ -41,7 +42,7 @@ function scene6_load() | ||
41 | texts[5] = scoremul | 42 | texts[5] = scoremul |
42 | texts[6] = "" | 43 | texts[6] = "" |
43 | texts[7] = "mega total:" | 44 | texts[7] = "mega total:" |
44 | - texts[8] = math.ceil(points*scoremul) | 45 | + texts[8] = scoretot |
45 | 46 | ||
46 | prevt = 0 | 47 | prevt = 0 |
47 | 48 | ||
@@ -106,7 +107,7 @@ function scene6_update(dt) | @@ -106,7 +107,7 @@ function scene6_update(dt) | ||
106 | end | 107 | end |
107 | 108 | ||
108 | if starttimer >= 15.7 and starttimer -dt < 15.7 then | 109 | if starttimer >= 15.7 and starttimer -dt < 15.7 then |
109 | - print(string.format("SCORE:%d", math.ceil(points*scoremul))); | 110 | + print("SCORE:" .. scoretot .. ":" .. pseudo) |
110 | ended = true | 111 | ended = true |
111 | staralpha = 1 | 112 | staralpha = 1 |
112 | 113 | ||
@@ -119,6 +120,11 @@ function scene6_update(dt) | @@ -119,6 +120,11 @@ function scene6_update(dt) | ||
119 | for i,v in pairs(stars) do | 120 | for i,v in pairs(stars) do |
120 | v:update(dt) | 121 | v:update(dt) |
121 | end | 122 | end |
123 | + | ||
124 | + if starttimer >= 20 and starttimer -dt < 20 then | ||
125 | + changegamestate("menu") | ||
126 | + credits:pause() | ||
127 | + end | ||
122 | end | 128 | end |
123 | 129 | ||
124 | function scene6_draw() | 130 | function scene6_draw() |
@@ -175,16 +181,4 @@ function scene6_draw() | @@ -175,16 +181,4 @@ function scene6_draw() | ||
175 | love.graphics.setColor(255, 255, 255) | 181 | love.graphics.setColor(255, 255, 255) |
176 | end | 182 | end |
177 | 183 | ||
178 | - if ended and starttimer % (5/12) > (5/24) then | ||
179 | - properprint("appuie sur espace pour recommencer", 15, 50, scale/4) | ||
180 | - end | ||
181 | -end | ||
182 | - | ||
183 | -function scene6_keypressed(key, unicode) | ||
184 | - if ended then | ||
185 | - credits:pause() | ||
186 | - changegamestate("menu") | ||
187 | - -- love.load() | ||
188 | - -- love.event.quit() | ||
189 | - end | ||
190 | end | 184 | end |