AKA "Project Ben Biri"
Game for Ludum Dare 47 - "Stuck in a loop"
- Install Love2d https://love2d.org/#download
- (Windows) add "C:\Program Files\LOVE" to your path - guide
In VSCode, press F4 then choose "Launch game".
Copy files into /src/lib
then reference them with `require "lib/"
Create a class with
MyClass = { }
function MyClass:create()
instance = {}
setmetatable(instance, self)
self.__index = self
return instance
end
extend a class with
SubClass = MyClass:create()
add a method to your class with
function Class:foo()
print("Hello world");
end
-- Methods on subclasses will be used instead of the method on the parent class.
function SubClass:bar()
self.foo()
end
call methods with :
local instance = SubClass:create()
instance:bar() -- This will print "Hello world"
set and define properties with .
instance.prop = "hi"
print(instance.prop)