Entity = class("Entity") function Entity:initialize(t) self.gridX, self.gridY = t.x, t.y self.gridSize = {x = t.sizeX, y = t.sizeY} self.color = Color:new(t.color) self.collision = t.collision --either "none", "moveable", "unmoveable" end function Entity:atGridPos(x, y) if x >= self.gridX and x <= self.gridX + self.gridSize.x and y >= self.gridY and y <= self.gridSize.y then return true end return false end function Entity:getGridPos() return {x = self.gridX, y = self.gridY} end function Entity:getDrawPos() local gridPos = self:getGridPos() return { x = (gridPos.x - 1) * width / gridWidth, y = (gridPos.y - 1) * height / gridHeight } end