Cleaned collisions.lua, objobjects.lua. Fixed level optimization typo. Added fairy FCS (altitude hold).

This commit is contained in:
lustlion
2022-02-08 08:22:27 +01:00
parent 010c19b10f
commit 1f7d967f77
7 changed files with 134 additions and 85 deletions

View File

@@ -2,31 +2,28 @@ Collision = {}
--[[
Collision
[bool] isDisabled
[bool flag] isDisabled
> if true used for collision
[bool] isActive
> if true, this collision is active (on collision, duh)
[bool] isColliding
[bool flag] isColliding
> if true, this collision is colliding
[2d pos] from - x, y
> top right corner of collision box
[vec2 position] from - x, y
> top right corner of collision box
[2d pos] to - x, y
[vec2 position] to - x, y
> bottom left corner of collision box
[int] width
[int property] width
> width of collision box
[int] height
[int property] height
> height of collision box
--]]
-- can also be called with only ox and oy, where they become the width and height instead
function Collision:New(ox,oy,tx,ty)
local o = {isColliding = false, isDisabled = false, isActive = false}
local o = {isColliding = false, isDisabled = false}
if tx ~= nil and ty ~= nil then
o.from = {x = ox, y = oy}
@@ -65,8 +62,6 @@ end
function Collision:Draw(color)
if self.isColliding == true then
love.graphics.setColor(0,1,0,0.5)
elseif self.isActive == 1 then
love.graphics.setColor(0,1,1,0.5)
elseif color == 1 then
love.graphics.setColor(1,0,0,0.5)
elseif color == 2 then