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

@ -4,7 +4,7 @@ Input.playermovekeys = { up = "up", down = "down", left = "left", right = "right
Input.playerswitchkeys = { ["1"] = "1", ["2"] = "2", ["3"] = "3"}
Input.colorfromkey = {"red", "green", "blue"}
function Input:handler()
function Input:handler(dt)
end

View file

@ -1,6 +1,5 @@
love.graphics.setDefaultFilter("linear", "nearest")
class = require "libs/middleclass"
Timer = require "libs/hump/timer"
sfxr = require "libs/sfxrlua/sfxr"
@ -33,8 +32,8 @@ function love.load()
end
function love.update(dt)
Input:handler()
currentRoom:update()
Input:handler(dt)
currentRoom:update(dt)
if love.keyboard.isDown("w") then worldSha = worldSha + 1 end
if love.keyboard.isDown("s") then worldSha = worldSha - 1 end

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