Hexadecimal colors, particle data, cleaned a bit of entities, added player dash animation particles
This commit is contained in:
@@ -5,12 +5,15 @@ function Entity:New(x,y)
|
||||
o.pos = {x = x, y = y}
|
||||
o.vel = {x = 0, y = 0}
|
||||
|
||||
o.direction = 0
|
||||
|
||||
o.boxCollision = {
|
||||
from = {x = x, y = y},
|
||||
to = {x = x, y = y},
|
||||
}
|
||||
|
||||
o.target_offset = {x = 0, y = 0}
|
||||
|
||||
o.sprite_offset = {x = 0, y = 0}
|
||||
o.sprite_scale = {x = 1, y = 1}
|
||||
o.sprite_rotation = math.rad(0)
|
||||
@@ -25,6 +28,34 @@ function Entity:New(x,y)
|
||||
return o
|
||||
end
|
||||
|
||||
function Entity:Smart()
|
||||
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
|
||||
|
||||
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],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,
|
||||
self.sprite_rotation,
|
||||
self.sprite_scale.x * self.sprite_flip.x,
|
||||
self.sprite_scale.y * self.sprite_flip.y
|
||||
)
|
||||
love.graphics.setColor(c1,c2,c3,a)
|
||||
end
|
||||
|
||||
function Entity:centerOffset(animation,x,y)
|
||||
local x = x or 0
|
||||
local y = y or 0
|
||||
@@ -43,19 +74,6 @@ function Entity:getBoundingBox(animation,left,right,top,bottom)
|
||||
self.boxCollision.to.y = animation.imgs[1]:getHeight()/2 + bottom
|
||||
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],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,
|
||||
self.sprite_rotation,
|
||||
self.sprite_scale.x * self.sprite_flip.x,
|
||||
self.sprite_scale.y * self.sprite_flip.y
|
||||
)
|
||||
love.graphics.setColor(c1,c2,c3,a)
|
||||
end
|
||||
|
||||
-- returns true if theres a collision at that point. also marks collisioned tile as collision true
|
||||
function Entity:isCollidingAt(x,y,object)
|
||||
local result = false
|
||||
@@ -90,18 +108,6 @@ 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"
|
||||
|
||||
Reference in New Issue
Block a user