-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmode-ending.fnl
41 lines (33 loc) · 1.03 KB
/
mode-ending.fnl
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
(local music (require :music))
(var timer 0)
(var frame 0)
(fn init []
(music.stop-all-tracks)
(set frame 0)
(set timer 0))
(fn draw []
(local canvas (love.graphics.getCanvas))
(local w (canvas:getWidth))
(love.graphics.printf "Credits:" 0 150 (/ w 3) :center 0 3)
(love.graphics.printf "Code: Daw-Ran Liou" 0 180 (/ w 3) :center 0 3)
(love.graphics.printf "Art: Daw-Ran Liou" 0 210 (/ w 3) :center 0 3)
(love.graphics.printf "Music: Beau Buckley" 0 240 (/ w 3) :center 0 3)
(love.graphics.printf "SFX: Daw-Ran Liou" 0 270 (/ w 3) :center 0 3)
(love.graphics.printf "The end" 0 350 (/ w 3) :center 0 3)
(when (and (< 3 timer) (< frame 30))
(love.graphics.printf "press 'x' to restart" 0 450 (/ w 3) :center 0 3)))
(fn update [dt]
(music.play-track :general)
(set frame (+ frame 1))
(when (= frame 60)
(set frame 0))
(set timer (+ timer dt)))
(fn keypressed [key set-mode]
(when (< 3 timer)
(case key
"x" (set-mode :mode-intro))))
;; load time side effect
(init)
{: draw
: update
: keypressed}