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

40 lines
1 KiB
Lua
Raw Normal View History

2021-05-05 08:30:32 +02:00
local Base = require "birb.modules.world.actors.actor3D"
2019-07-26 19:39:32 +02:00
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))
if (math.floor(drawz) < -2) and (self.world.maptype == "shoot") then
core.screen:setScissor(0, 0, 424, 58+drawy/2)
self:drawSprite(x, y)
core.screen:resetScissor()
else
self:drawSprite(x, y)
end
end
self:drawEnd()
2019-07-27 20:55:00 +02: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-07-27 21:02:33 +02:00
self.assets.images["shadow"]:draw(x-4, y+4)
2019-07-26 19:39:32 +02:00
end
return Parent