From 97286c4456282048085f1a6641e01715a4f7fc5f Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 22 May 2016 20:58:08 +0200 Subject: Reload map key --- main.lua | 5 +++++ world.lua | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index c802f0b..8a59bba 100644 --- a/main.lua +++ b/main.lua @@ -71,6 +71,11 @@ function love.keypressed (key) if key == "escape" then love.event.quit() end + if key == "f5" and debug then + local new = World:new("default", "leon", "lonestar", third, fourth) + w = nil + w = new + end end -- KeyReleased diff --git a/world.lua b/world.lua index 98d0c0b..6ef294c 100644 --- a/world.lua +++ b/world.lua @@ -60,9 +60,9 @@ end -- Load map from file function World:loadMap(name) local name = name or "default" - name = "maps/" .. name - local map = require(name) - self.map = map + name = "maps/" .. name .. ".lua" + local map = love.filesystem.load(name) + self.map = map() for _,platform in pairs(self.map.platforms) do self:createPlatform(platform.x, platform.y, platform.shape, platform.sprite) end -- cgit v1.1