basic serialization worx*

*
This commit is contained in:
0x81c 2015-03-17 01:59:14 -04:00
parent d76ace8f69
commit 973a8ab25b
41 changed files with 162 additions and 82 deletions

View file

@ -5,6 +5,7 @@ function Entity:initialize(t)
self.spriteSize = {w = t.sprite:getWidth(), h = t.sprite:getHeight()}
self.size = {w = self.spriteSize.w / 16, h = self.spriteSize.h / 16}
self.cellShape = t.cellShape or self:cellShapeFromBox(self.size)
self.name = t.name
self.color = Color:new(t.color)
self.collision = t.collision --"none", "moveable", "unmoveable"
self.sprite = t.sprite
@ -123,9 +124,8 @@ end
function Entity:getSerializationTable()
local pos = self:getGridPos()
local table = {}
table.x, table.y, table.color = pos.x, pos.y, color
table.x, table.y, table.color = pos.x, pos.y, self.color:getname()
if self.name then table.name = self.name end
return table
end