naming convention for most stuff but not all

This commit is contained in:
lustlion
2022-03-04 23:28:30 +01:00
parent c978855711
commit cef2096577
29 changed files with 354 additions and 436 deletions

View File

@@ -30,7 +30,7 @@ LoadedObjects.Rooms = {}
--]]
-- can also be called with only ox and oy, where they become the width and height instead
function Collision:New(ox,oy,tx,ty)
function Collision:new(ox,oy,tx,ty)
local o = {isColliding = false, isDisabled = false}
if tx ~= nil and ty ~= nil then
@@ -55,28 +55,28 @@ end
function Collision:CenterAt(x, y)
function Collision:centerAt(x, y)
self.from.x = x-self.width/2
self.from.y = y-self.height/2
self.to.x = x+self.width/2
self.to.y = y+self.height/2
end
function Collision:PlaceAt(x, y)
function Collision:placeAt(x, y)
self.from.x = x or self.from.x
self.from.y = y or self.from.y
self.to.x = self.from.x + self.width
self.to.y = self.from.x + self.height
end
function Collision:ContainsPoint(x, y)
function Collision:containsPoint(x, y)
return x >= self.from.x and
y >= self.from.y and
x <= self.to.x and
y <= self.to.y
end
function Collision:Draw(color)
function Collision:draw(color)
if self.isColliding == true then
love.graphics.setColor(0,1,0,0.5)
elseif color == 1 then
@@ -88,10 +88,3 @@ function Collision:Draw(color)
love.graphics.setColor(0,1,90,0.5)
love.graphics.rectangle("line",self.from.x-Camera.pos.x, self.from.y-Camera.pos.y, self.width, self.height)
end
function DrawRooms()
for _, room in pairs(LoadedObjects.Rooms) do
love.graphics.setColor(0,0,100,1)
love.graphics.rectangle("line",room.from.x-Camera.pos.x, room.from.y-Camera.pos.y, room.width, room.height)
end
end