sonic-bluestreak/sonic-bluestreak.love/game/modules/world/actors/parent.lua

34 lines
845 B
Lua
Raw Normal View History

2019-12-28 12:15:43 +01:00
local Base = require "core.modules.world.actors.actor3D"
local Parent = Base:extend()
function Parent:new(world, type, x, y, z, w, h, d, isSolid)
self.scene = world.scene
Parent.super.new(self, world, type, x, y, z, w, h, d, isSolid)
end
function Parent:draw()
local drawx, drawy, drawz = self.x, self.y, self.z
if (self.world.maptype == "shoot") then
drawx = drawx + math.floor(drawy/2)
end
self:drawStart()
if (self.box ~= nil) then
self.box:draw(drawx, drawy, drawz)
else
local x, y = math.floor(drawx), math.floor(drawy - drawz - self.d + (self.h/2))
self:drawSprite(x, y)
end
self:drawEnd()
2019-12-28 12:15:43 +01:00
end
function Parent:drawShadow(x, y)
local x = x or 0
local y = y or 0
if (self.world.maptype == "shoot") then
x = x + math.floor(y/2)
end
2019-12-28 12:15:43 +01:00
self.assets.images["shadow"]:draw(x-4, y+4)
end
return Parent