Created Particles, added fairy particle, added more entity methods like kill() and entity id

This commit is contained in:
lustlion
2022-01-19 23:29:02 +01:00
parent 15e8142c4c
commit 50f126fa7b
77 changed files with 106 additions and 26 deletions

View File

@@ -15,11 +15,13 @@ function Entity:New(x,y)
o.sprite_scale = {x = 1, y = 1}
o.sprite_rotation = math.rad(0)
o.sprite_tint = {1,1,1}
o.sprite_alpha = 1
o.sprite_flip = { x = 1, y = 1}
o.illuminated = false
setmetatable(o, self)
self.__index = self
return o
end
@@ -43,7 +45,7 @@ end
function Entity:Draw(animation)
local c1, c2, c3, a = love.graphics.getColor()
love.graphics.setColor(self.sprite_tint[1],self.sprite_tint[2],self.sprite_tint[3])
love.graphics.setColor(self.sprite_tint[1],self.sprite_tint[2],self.sprite_tint[3],self.sprite_alpha)
animation:Draw(
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
@@ -88,8 +90,21 @@ function Entity:isCollidingAtAll(x,y)
return result
end
function Entity:Kill()
if self.id ~= nil then
for _, e in pairs(LoadedEntities) do
if e.id > self.id then
e.id = e.id - 1
end
end
table.remove(LoadedEntities,self.id)
end
self = nil
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/particle"