paulofmandown / rotLove

Roguelike Toolkit in Love. A Love2D/lua port of rot.js
http://paulofmandown.github.io/rotLove/
Other
258 stars 25 forks source link

Remove globals, etc. #25

Closed airstruck closed 7 years ago

airstruck commented 7 years ago

Also updated preciseWithMovingPlayer demo just for testing purposes (none of the demos tested the files in /src; they weren't actually working due to a few typos).

airstruck commented 7 years ago

Just tried swapping 30log out with Middleclass; looks something like this:

local class = require 'middleclass'
BaseClass = class('BaseClass')

function BaseClass:initialize (...)
    self:init(...)
end

function BaseClass:extend (name, proto)
    local child = class(name, self)
    if proto then
        for k, v in pairs(proto) do child[k] = v end
    end
    return child
end

Could be useful if someone wants a particular class library badly enough, maybe for serialization or debugging.