diff options
| author | the lemons <citrons@mondecitronne.com> | 2022-08-27 01:23:20 -0500 |
|---|---|---|
| committer | the lemons <citrons@mondecitronne.com> | 2022-08-27 01:23:20 -0500 |
| commit | 8bb18a89060ecd581a06238ce3fa5d2170ee3a15 (patch) | |
| tree | 25baba9d2c267b986adfe7af661b3cd99a32b346 /game.lua | |
| parent | 001272dbcbaa1110541e0666af3cea1c97bc199f (diff) | |
implement component system
Diffstat (limited to 'game.lua')
| -rw-r--r-- | game.lua | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/game.lua b/game.lua deleted file mode 100644 index 16b1e06..0000000 --- a/game.lua +++ /dev/null @@ -1,43 +0,0 @@ -local Obj = require 'Obj' - -local M = {} - -M.all_objects = {} - -M.Object = Obj:extend() -M.Object.z = 0 - -function M.Object:new(pos, rotation, scale) - self.pos = pos or {0, 0, 0} - self.rot = rotation or 0 - self.scale = scale or 1 - self:enable() -end - -function M.Object:enable() - M.all_objects[self] = true -end - -function M.Object:disable() - M.all_objects[self] = nil -end - -function M.Object:update() -end - -function M.Object:draw() - if self.sprite then - local x, y = unpack(self.pos) - local w, h = self.sprite:getDimensions() - ox = (w * self.scale) / 2 - oy = (h * self.scale) / 2 - love.graphics.draw( - self.sprite, x, y, self.rot, self.scale, self.scale, ox, oy) - end -end - -function M.Object:visible() - return not self.hidden -end - -return M |
