editor progress, generic keybinds, player coyote value, cursed book entity, level changes, camera adjustments

This commit is contained in:
lustlion
2022-01-29 08:49:45 +01:00
parent 90ed1f6460
commit a1bf842cef
41 changed files with 387 additions and 154 deletions

View File

@@ -39,9 +39,20 @@ end
function Entity:CollisionMove()
if not self:isCollidingAt(self.pos.x + self.vel.x, self.pos.y, LoadedObjects.Collisions) then
self.pos.x = self.pos.x + self.vel.x
else
self.vel.x = 0
end
if not self:isCollidingAt(self.pos.x, self.pos.y + self.vel.y, LoadedObjects.Collisions) then
self.pos.y = self.pos.y + self.vel.y
else
self.vel.y = 0
end
end
function Entity:LightAdjust()
if self.light ~= nil then
self.light.pos.x = self.pos.x
self.light.pos.y = self.pos.y
end
end
@@ -80,7 +91,7 @@ function Entity:centerOffset(animation,x,y)
self.sprite_offset.y = animation.imgs[1]:getHeight()/2 + y
end
function Entity:getBoundingBox(animation,left,right,top,bottom)
function Entity:getBoundingBox(animation,top,left,bottom,right)
local left = left or 0
local right = right or 0
local top = top or 0
@@ -125,9 +136,24 @@ function Entity:isCollidingAtAll(x,y)
return result
end
function Entity:Debug()
-- draw center GREEN
love.graphics.setColor(0,1,0)
love.graphics.circle("fill", -Camera.pos.x + self.pos.x, -Camera.pos.y + self.pos.y, 1)
-- draw collision box PURPLE
love.graphics.setColor(1,0,1)
love.graphics.rectangle(
"line",
-Camera.pos.x + self.pos.x + self.boxCollision.from.x,
-Camera.pos.y + self.pos.y + self.boxCollision.from.y,
-Camera.pos.x + self.pos.x + self.boxCollision.to.x -(-Camera.pos.x + self.pos.x + self.boxCollision.from.x),
-Camera.pos.y + self.pos.y + self.boxCollision.to.y -(-Camera.pos.y + self.pos.y + self.boxCollision.from.y)
)
end
require "data/scripts/entities/kupo"
require "data/scripts/entities/arrow"
require "data/scripts/entities/decoration"
require "data/scripts/entities/player"
require "data/scripts/entities/fairy"
require "data/scripts/entities/cursed_book"
require "data/scripts/entities/particle"