X Tutup
Skip to content

Commit be28803

Browse files
committed
add music and title (things are staring to fall apart :(
1 parent d9e40ff commit be28803

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

audio/slime.ogg

904 KB
Binary file not shown.

audio/slime_title.ogg

540 KB
Binary file not shown.

img/title.png

27.3 KB
Loading

main.moon

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ class Player extends Entity
138138
hello = Printer "hello\nworld!\n\nahehfehf\n\nAHHHHHFeefh\n\n...\nhelp me"
139139

140140
class Game
141+
onload: (@dispatch) => sfx\play_music "slime"
142+
141143
new: =>
142144
@viewport = EffectViewport scale: 3
143145
-- g.setLineWidth 1/@viewport.screen.scale
@@ -186,6 +188,20 @@ class Game
186188
when ";"
187189
sfx\play "step"
188190

191+
class Title
192+
onload: (@dispatch) => sfx\play_music "slime_title"
193+
new: =>
194+
@bg = imgfy "img/title.png"
195+
@viewport = EffectViewport scale: 1
196+
197+
draw: =>
198+
@bg\draw 0,0
199+
200+
on_key: (key, code) =>
201+
print "key", key, code
202+
if key == "return"
203+
@dispatch\push Game!
204+
189205
export fonts = {}
190206
load_font = (img, chars)->
191207
font_image = imgfy img
@@ -210,13 +226,13 @@ love.load = ->
210226

211227
g.setFont fonts.main
212228

213-
game = Game!
214-
dispatch = Dispatcher game
229+
-- game = Game!
230+
dispatch = Dispatcher Title!
215231
dispatch\bind love
216232

217233
love.mousepressed = (x,y, button) ->
218-
x, y = game.viewport\unproject x, y
219-
print "mouse", x, y, button
220-
print game.world.map
234+
-- x, y = game.viewport\unproject x, y
235+
-- print "mouse", x, y, button
236+
-- print game.world.map
221237

222238

0 commit comments

Comments
 (0)
X Tutup