requires tserial module, minor set up for serizlation

This commit is contained in:
0x81c 2015-03-16 09:06:51 -04:00
parent cd2e0d862a
commit 7fa31726f4
3 changed files with 20 additions and 6 deletions

View file

@ -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