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

@@ -26,16 +26,23 @@ Particle = Entity:New(x,y)
y = o.speed * math.sin(o.direction)
}
o.speed_increase = particle_data.speed_increase or 0
if particle_data.light ~= nil then
o.lightRange = particle_data.light
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange)
local flicker = particle_data.light_flicker or nil
local color = particle_data.light_color or nil
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange,flicker,color)
end
-- animations
o.body = Animation:New(particle_data.animation)
o:centerOffset(o.body)
if not o.animation_active then
o.body.speed = 0
if particle_data.animation ~= nil then
o.body = Animation:New(particle_data.animation)
o:centerOffset(o.body)
o:getBoundingBox(o.body)
if not o.animation_active then
o.body.speed = 0
end
end
table.insert(LoadedParticles,o)
@@ -62,16 +69,32 @@ function Particle:Kill()
end
function Particle:HandleAnimation()
self.body:Animate()
self.timer = self.timer + current_dt
self.sprite_alpha = self.sprite_alpha_base*(self.time-self.timer)/self.time
if self.light ~= nil then
self:LightAdjust()
self.light.range = self.lightRange * self.sprite_alpha/2
end
if self.sprite_alpha < 0 then self:Kill() end
self:Draw(self.body)
if self.body ~= nil then
self.body:Animate()
self:Draw(self.body)
end
end
function Particle:DoPhysics()
self:Move()
-- adjust speed
if self.speed_increase ~= 0 then
self.speed = self.speed + self.speed_increase
self.vel.x = self.speed * math.cos(self.direction)
self.vel.y = self.speed * math.sin(self.direction)
end
-- move
self:CollisionMove()
end
function Particle:Debug()
-- draw center CYAN
love.graphics.setColor(0,1,1)
love.graphics.circle("fill", -Camera.pos.x + self.pos.x, -Camera.pos.y + self.pos.y, 1)
end