scenes/worldmap: quick fix for key handling
This commit is contained in:
parent
e01f767c74
commit
a6361a6e21
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue