Created Particles, added fairy particle, added more entity methods like kill() and entity id
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user