requires tserial module, minor set up for serizlation
This commit is contained in:
parent
cd2e0d862a
commit
7fa31726f4
3 changed files with 20 additions and 6 deletions
19
room.lua
19
room.lua
|
|
@ -1,5 +1,6 @@
|
|||
Room = class("Room")
|
||||
|
||||
require "libs/TSerial"
|
||||
require "player"
|
||||
require "box"
|
||||
require "wall"
|
||||
|
|
@ -173,7 +174,10 @@ function Room:movePlayer(key)
|
|||
|
||||
local initialTargetEntity
|
||||
|
||||
initialTargetEntity = self:getCellInMatrix(self.collidableMatrices[color], initialTargetCell)
|
||||
if self:isInBounds(initialTargetCell) then
|
||||
initialTargetEntity = self:getCellInMatrix(self.collidableMatrices[color], initialTargetCell)
|
||||
end
|
||||
|
||||
if initialTargetEntity then initialTargetEntity:bump() end
|
||||
|
||||
if not self:isInBounds(initialTargetCell) then
|
||||
|
|
@ -467,6 +471,14 @@ function Room:nextRoomCheck()
|
|||
end
|
||||
end
|
||||
|
||||
function Room:save()
|
||||
self:serialize()
|
||||
end
|
||||
|
||||
function Room:serialize()
|
||||
|
||||
end
|
||||
|
||||
function nextRoom(pos)
|
||||
local exit
|
||||
local newPos = {x = pos.x, y = pos.y}
|
||||
|
|
@ -484,9 +496,12 @@ function nextRoom(pos)
|
|||
newPos.y = gridHeight
|
||||
end
|
||||
|
||||
currentRoom:save()
|
||||
|
||||
currentRoom = Room:new{
|
||||
player = {
|
||||
x = newPos.x, y = newPos.y, activeColors = currentRoom:getActiveColors()
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue