scene/worldmap: make worldmap able to load levels

This commit is contained in:
Kazhnuz 2019-03-10 10:23:05 +01:00
parent 5b87331143
commit 4d772de731
2 changed files with 11 additions and 0 deletions

View File

@ -77,6 +77,12 @@ function WorldMap:update(dt)
self.cursor.canMove = true
end
if (self.keys["A"].isPressed) and (self.cursor.canMove) then
if (self.cursor.dotAtPoint ~= nil) then
self.cursor.dotAtPoint:action()
end
end
self.cursor.dotAtPoint = self:getDotAtPoint(self.cursor.x, self.cursor.y)
end

View File

@ -2,6 +2,7 @@ local LevelDot = Object:extend()
function LevelDot:new(scene, levelname)
self.scene = scene
self.name = levelname
self.data = require("datas.levels." .. levelname)
self.isActive = self.data.isActive or true
@ -20,6 +21,10 @@ function LevelDot:draw()
end
end
function LevelDot:action()
scenes.Levels(self.name, 0)
end
function LevelDot:drawName()
local _, w, h = 0, core.screen:getDimensions()
self.scene.assets.fonts["small"]:set()