This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mx, my | |
function love.load() | |
end | |
function love.update(dt) | |
mx, my = love.mouse.getPosition() | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A slightly edited version of https://github.com/Vorlias/ROBLOX-ModuleScripts/blob/master/Lua-OOP/ModObject.rbxs | |
ModObject = { | |
Version = 1.4; | |
EnableStructConstructor = true; | |
}; | |
CustomObjects = { | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Signal = {} | |
local mobj = require("ModObject") | |
function Signal.New() | |
local sig = Signal:Init() | |
sig.connection = nil | |
return sig | |
end | |
function Signal:Connect(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Player = {} | |
local mobj = require("System/Libraries/ModObject") | |
local Inventory = require("System/Classes/Inventory") | |
local Signal = require("System/Classes/Signal") | |
Player.Died = Signal.New() | |
function Player.New(x, y, sprite, speed, hp, currentLevel) | |
local player = Player:Init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Requirementssststststs | |
local mobj = require("System/Libraries/ModObject") | |
local Inventory = require("System/Classes/Inventory") | |
local Signal = require("System/Classes/Signal") | |
local Vector2 = require("System/Classes/Vector2") | |
--Constants | |
local PLAYER_ACCELERATE = 20 | |
local PLAYER_MAXVELOCITY = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mobj = require("System/Libraries/ModObject") | |
local Vector2 = {} | |
local sqrt = math.sqrt | |
function Vector2.New(x, y) | |
local vec2 = Vector2:Init() | |
vec2.x = x or 0 | |
vec2.y = y or 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mobj = require("System/Libraries/ModObject") | |
local Vector2 = {} | |
local sqrt = math.sqrt | |
function Vector2.New(x, y) | |
local vec2 = Vector2:Init() | |
vec2.x = x or 0 | |
vec2.y = y or 0 | |
return vec2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CustomObjects = { | |
}; | |
CustomObjectsFullName = { | |
}; | |
Object = { | |
ClassName = "Object"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Vector2 = {} | |
local sqrt = math.sqrt | |
function Vector2.New(x, y) | |
local vec2 = {} | |
setmetatable(vec2, Vector2) | |
vec2.x = x or 0 | |
vec2.y = y or 0 | |
return vec2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
OBJECT MODULE | |
v1.4 | |
(C) Jonathan Holmes 2014 | |
Edits by Elmeri Ferm: | |
added metamethod overriding | |
Usage: | |