@@ -138,6 +138,8 @@ class Player extends Entity
138138hello = Printer " hello\n world!\n\n ahehfehf\n\n AHHHHHFeefh\n\n ...\n help me"
139139
140140class 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+
189205export fonts = {}
190206load_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