Shader for lighting, fairy line of view, tileset change, broke lights, sorry
This commit is contained in:
@@ -12,7 +12,7 @@ function Decoration:New(x,y,animation,lightRange)
|
||||
|
||||
if lightRange ~= nil then
|
||||
o.lightRange = lightRange
|
||||
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange,nil,60/6)
|
||||
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange)
|
||||
end
|
||||
|
||||
table.insert(LoadedEntities,o)
|
||||
|
||||
@@ -5,7 +5,7 @@ Fairy = Entity:New(x,y)
|
||||
|
||||
-- behaviour
|
||||
o.pos = {x = x, y = y}
|
||||
o.speed = 0.23
|
||||
o.speed = 1
|
||||
o.range = 20
|
||||
o.target = {x = x, y = y}
|
||||
|
||||
@@ -32,19 +32,22 @@ Fairy = Entity:New(x,y)
|
||||
|
||||
function Fairy:Smart()
|
||||
|
||||
self.target.x = main_Player.pos.x - main_Player.target_offset.x
|
||||
self.target.y = main_Player.pos.y - main_Player.target_offset.y - 10
|
||||
if self:CheckVisionLine(main_Player) then
|
||||
self.target.x = main_Player.pos.x + main_Player.target_offset.x
|
||||
self.target.y = main_Player.pos.y + main_Player.target_offset.y
|
||||
end
|
||||
|
||||
local distance_x = self.target.x - self.pos.x
|
||||
local distance_y = self.target.y - self.pos.y
|
||||
local angle = GetAngleFromVector(distance_x,distance_y)
|
||||
local distance = math.sqrt(distance_x ^ 2 + distance_y ^ 2)
|
||||
|
||||
if distance < self.range then
|
||||
self.vel.x = 0
|
||||
self.vel.y = 0
|
||||
else
|
||||
self.vel.x = math.cos(angle)*self.speed*distance/8
|
||||
self.vel.y = math.sin(angle)*self.speed*distance/8
|
||||
|
||||
self.vel.x = math.cos(angle)*self.speed
|
||||
self.vel.y = math.sin(angle)*self.speed
|
||||
end
|
||||
self.particle_timer = self.particle_timer + 1
|
||||
if self.particle_timer >= self.particle_time then
|
||||
@@ -72,8 +75,8 @@ function Fairy:HandleAnimation()
|
||||
end
|
||||
|
||||
function Fairy:DoPhysics()
|
||||
local random_x = math.random(-4, 4)/100
|
||||
local random_y = math.random(-4, 4)/100
|
||||
local random_x = math.random(-2, 2)/10
|
||||
local random_y = math.random(-2, 2)/10
|
||||
self.vel.x = self.vel.x + random_x
|
||||
self.vel.y = self.vel.y + random_y
|
||||
-- move
|
||||
@@ -81,3 +84,8 @@ function Fairy:DoPhysics()
|
||||
self:CollisionMove()
|
||||
self:LightAdjust()
|
||||
end
|
||||
|
||||
function Fairy:Debug()
|
||||
Entity.Debug(self)
|
||||
self:CheckVisionLineDebug(main_Player)
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
to = {x = 8, y = 0} -- gameworld pixels
|
||||
}
|
||||
|
||||
o.lightRange = 344 -- screen pixels
|
||||
o.lightRange = 0 -- screen pixels
|
||||
|
||||
-- status
|
||||
o.isDashing = false
|
||||
@@ -47,7 +47,7 @@
|
||||
o.maskType = animation.moth_mask
|
||||
|
||||
-- sprite
|
||||
o.target_offset = {x = 0, y = 12}
|
||||
o.target_offset = {x = 0, y = 0}
|
||||
o.body = Animation:New(animation.nancy.idle)
|
||||
o.mask = Animation:New(animation.moth_mask.idle)
|
||||
o:centerOffset(o.body)
|
||||
|
||||
Reference in New Issue
Block a user