Fixed particles, reduced light radius of visible light

This commit is contained in:
lustlion 2022-02-21 18:48:24 +01:00
parent a944192f67
commit f0bc02c418
5 changed files with 16 additions and 14 deletions

View File

@ -18,7 +18,7 @@ end
function Darkness.Reset() function Darkness.Reset()
love.graphics.setCanvas(Canvas.Darkness) love.graphics.setCanvas(Canvas.Darkness)
love.graphics.setBlendMode("replace") love.graphics.setBlendMode("replace")
love.graphics.setColor(0.1,0.1,0.1,1) love.graphics.setColor(0,0,0,0.95)
love.graphics.rectangle( love.graphics.rectangle(
"fill", "fill",
0, 0,

View File

@ -28,9 +28,9 @@ end
function HookAnchor:DrawBackground() function HookAnchor:DrawBackground()
Entity.DrawBackground(self) Entity.DrawBackground(self)
love.graphics.setColor(1,1,1,1) love.graphics.setColor(1,1,1,0)
love.graphics.circle( love.graphics.circle(
"line", "fill",
-Camera.pos.x + self.pos.x, -Camera.pos.x + self.pos.x,
-Camera.pos.y + self.pos.y, -Camera.pos.y + self.pos.y,
self.hookDistance self.hookDistance

View File

@ -199,6 +199,16 @@ function Player:DoPhysics()
if self.isHooked then if self.isHooked then
local hook = Vector(self.pos.x, self.pos.y, self.hookAnchor.x, self.hookAnchor.y) local hook = Vector(self.pos.x, self.pos.y, self.hookAnchor.x, self.hookAnchor.y)
if GetVectorValue(hook) > self.hookDistance then if GetVectorValue(hook) > self.hookDistance then
local hook_angle = GetAngleFromVector(hook[1],hook[2])-math.rad(180)
if Keybind:CheckDown(Keybind.move.right) then
hook_angle = hook_angle - math.rad(0.05)
self.move_x = 0
end
if Keybind:CheckDown(Keybind.move.left) then
hook_angle = hook_angle + math.rad(0.05)
self.move_x = 0
end
local particle_data = { local particle_data = {
animation = self.body, animation = self.body,
sprite_tint = HEX2RGB("#fed100"), sprite_tint = HEX2RGB("#fed100"),
@ -209,15 +219,7 @@ function Player:DoPhysics()
} }
} }
Particle:New(self.pos.x,self.pos.y,particle_data) Particle:New(self.pos.x,self.pos.y,particle_data)
local hook_angle = GetAngleFromVector(hook[1],hook[2])-math.rad(180)
if Keybind:CheckDown(Keybind.move.right) then
hook_angle = hook_angle - math.rad(0.05)
self.move_x = 0
end
if Keybind:CheckDown(Keybind.move.left) then
hook_angle = hook_angle + math.rad(0.05)
self.move_x = 0
end
local pos_x = self.hookAnchor.x + self.hookDistance * math.cos(hook_angle) local pos_x = self.hookAnchor.x + self.hookDistance * math.cos(hook_angle)
local pos_y = self.hookAnchor.y + self.hookDistance * math.sin(hook_angle) local pos_y = self.hookAnchor.y + self.hookDistance * math.sin(hook_angle)
self.vel.x = self.vel.x + pos_x - self.pos.x self.vel.x = self.vel.x + pos_x - self.pos.x

View File

@ -36,7 +36,7 @@ end
function GameworldDrawParticles() function GameworldDrawParticles()
love.graphics.setColor(0.7,0.7,0.7) love.graphics.setColor(0.7,0.7,0.7)
for _, particle in pairs(LoadedParticles) do for _, particle in pairs(LoadedObjects.Particles) do
particle:HandleAnimation() particle:HandleAnimation()
end end
end end

View File

@ -13,7 +13,7 @@ Shader.RadiusGradient = love.graphics.newShader[[
float distance_y = pos_y - screen_coords.y / scale; float distance_y = pos_y - screen_coords.y / scale;
float distance = sqrt( pow(distance_x,2) + pow(distance_y,2) ) ; float distance = sqrt( pow(distance_x,2) + pow(distance_y,2) ) ;
if (distance < range){ if (distance < range){
float alpha = 1-(2*distance/range); float alpha = 1-(5*distance/range);
if (pixel.a > alpha){ if (pixel.a > alpha){
pixel.a = alpha; pixel.a = alpha;
} }