fix(worldmap): use the new reference for key handling
Since gamecore 0.5.0, keys are available in Scene.sources[sourceid].keys instead of Scene.keys.
This commit is contained in:
parent
0b8fafb556
commit
7d3de10a97
|
@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
|
||||||
- **gamecore:** updated to 0.5.0
|
- **gamecore:** updated to 0.5.0
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **worldmap:** use gamecore 0.5.0-style key handling
|
||||||
|
|
||||||
## Imperium-Porcorum 0.0.1
|
## Imperium-Porcorum 0.0.1
|
||||||
|
|
||||||
- Initial pre-alpha released based on source status before starting port to gamecore 0.5.0
|
- Initial pre-alpha released based on source status before starting port to gamecore 0.5.0
|
||||||
|
|
|
@ -37,22 +37,23 @@ function WorldMap:registerDot(dot)
|
||||||
end
|
end
|
||||||
|
|
||||||
function WorldMap:update(dt)
|
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.y = math.max(0, self.cursor.y - 1)
|
||||||
self.cursor.canMove = false
|
self.cursor.canMove = false
|
||||||
end
|
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.y = math.min(12, self.cursor.y + 1)
|
||||||
self.cursor.canMove = false
|
self.cursor.canMove = false
|
||||||
end
|
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.x = math.min(27, self.cursor.x + 1)
|
||||||
self.cursor.canMove = false
|
self.cursor.canMove = false
|
||||||
end
|
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.x = math.max(0, self.cursor.x - 1)
|
||||||
self.cursor.canMove = false
|
self.cursor.canMove = false
|
||||||
end
|
end
|
||||||
|
@ -77,7 +78,7 @@ 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 (keys["A"].isPressed) and (self.cursor.canMove) then
|
||||||
if (self.cursor.dotAtPoint ~= nil) then
|
if (self.cursor.dotAtPoint ~= nil) then
|
||||||
self.cursor.dotAtPoint:action()
|
self.cursor.dotAtPoint:action()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue