scene/worldmap: make worldmap able to load levels
This commit is contained in:
parent
5b87331143
commit
4d772de731
|
@ -77,6 +77,12 @@ function WorldMap:update(dt)
|
||||||
self.cursor.canMove = true
|
self.cursor.canMove = true
|
||||||
end
|
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)
|
self.cursor.dotAtPoint = self:getDotAtPoint(self.cursor.x, self.cursor.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ local LevelDot = Object:extend()
|
||||||
|
|
||||||
function LevelDot:new(scene, levelname)
|
function LevelDot:new(scene, levelname)
|
||||||
self.scene = scene
|
self.scene = scene
|
||||||
|
self.name = levelname
|
||||||
self.data = require("datas.levels." .. levelname)
|
self.data = require("datas.levels." .. levelname)
|
||||||
self.isActive = self.data.isActive or true
|
self.isActive = self.data.isActive or true
|
||||||
|
|
||||||
|
@ -20,6 +21,10 @@ function LevelDot:draw()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function LevelDot:action()
|
||||||
|
scenes.Levels(self.name, 0)
|
||||||
|
end
|
||||||
|
|
||||||
function LevelDot:drawName()
|
function LevelDot:drawName()
|
||||||
local _, w, h = 0, core.screen:getDimensions()
|
local _, w, h = 0, core.screen:getDimensions()
|
||||||
self.scene.assets.fonts["small"]:set()
|
self.scene.assets.fonts["small"]:set()
|
||||||
|
|
Loading…
Reference in New Issue