scenes/worldmap: quick fix for key handling

This commit is contained in:
Kazhnuz 2019-05-30 18:59:21 +02:00
parent e01f767c74
commit a6361a6e21
1 changed files with 7 additions and 5 deletions

View File

@ -37,22 +37,24 @@ function WorldMap:registerDot(dot)
end
function WorldMap:update(dt)
if (self.keys["up"].isDown) and (self.cursor.canMove) then
local keys = self.sources[1].keys
if (keys["up"].isDown) and (self.cursor.canMove) then
self.cursor.y = math.max(0, self.cursor.y - 1)
self.cursor.canMove = false
end
if (self.keys["down"].isDown) and (self.cursor.canMove) then
if (keys["down"].isDown) and (self.cursor.canMove) then
self.cursor.y = math.min(12, self.cursor.y + 1)
self.cursor.canMove = false
end
if (self.keys["right"].isDown) and (self.cursor.canMove) then
if (keys["right"].isDown) and (self.cursor.canMove) then
self.cursor.x = math.min(27, self.cursor.x + 1)
self.cursor.canMove = false
end
if (self.keys["left"].isDown) and (self.cursor.canMove) then
if (keys["left"].isDown) and (self.cursor.canMove) then
self.cursor.x = math.max(0, self.cursor.x - 1)
self.cursor.canMove = false
end
@ -77,7 +79,7 @@ function WorldMap:update(dt)
self.cursor.canMove = true
end
if (self.keys["A"].isPressed) and (self.cursor.canMove) then
if (keys["A"].isPressed) and (self.cursor.canMove) then
if (self.cursor.dotAtPoint ~= nil) then
self.cursor.dotAtPoint:action()
end