Jelajahi Sumber

Enter to go to next level;

bjorn 10 tahun lalu
induk
melakukan
deaf1cc6fe
2 mengubah file dengan 16 tambahan dan 1 penghapusan
  1. 15 0
      game.lua
  2. 1 1
      main.lua

+ 15 - 0
game.lua

@@ -86,6 +86,21 @@ function Game:keypressed(key)
     ctx.sound:mute()
   elseif key == 'p' then
     self.paused = not self.paused
+  elseif key == 'return' and ctx.hud.win.active then
+    Context:remove(ctx)
+    local world
+    local index
+    if ctx.map.name == 'kingdumb' and ctx.map.index == 3 then
+      -- Menu
+      return
+    elseif ctx.map.name == 'dinoland' and ctx.map.index == 3 then
+      world = 'Kingdumb'
+      index = 1
+    else
+      world = (ctx.map.name == 'dinoland') and 'Dinoland' or 'Kingdumb'
+      index = ctx.map.index + 1
+    end
+    Context:add(Game, world, index)
   end
 
   self.pigeon:keypressed(key)

+ 1 - 1
main.lua

@@ -2,5 +2,5 @@ require 'require'
 
 function love.load()
   data.load()
-  Context:bind(Game, 'Kingdumb', 3)
+  Context:bind(Game, 'Dinoland', 1)
 end