diff --git a/sonic-bluestreak.love/core/modules/world/actors/actor3D.lua b/sonic-bluestreak.love/core/modules/world/actors/actor3D.lua index c5f4208..b35bfd5 100644 --- a/sonic-bluestreak.love/core/modules/world/actors/actor3D.lua +++ b/sonic-bluestreak.love/core/modules/world/actors/actor3D.lua @@ -218,7 +218,10 @@ end -- Handle everything related to shadow function Actor3D:castShadow() - local shadowTargets = self.world:getTerrainInRect(self.x, self.y, self.w, self.d) + local SHADOW_CAST_AREA = 12 + local xshad, yshad = self.x-(SHADOW_CAST_AREA), self.y-(SHADOW_CAST_AREA) + local wshad, dshad = self.w+(SHADOW_CAST_AREA*2), self.d+(SHADOW_CAST_AREA*2) + local shadowTargets = self.world:getTerrainInRect(xshad, yshad, wshad, dshad) -- initialize the shadowTargetsPrevious variable if it doesn't exist if (self.shadowTargetsPrevious == nil) then self.shadowTargetsPrevious = {} diff --git a/sonic-bluestreak.love/game/modules/world/actors/floor.lua b/sonic-bluestreak.love/game/modules/world/actors/floor.lua index 12cc5ce..a2cf4ca 100644 --- a/sonic-bluestreak.love/game/modules/world/actors/floor.lua +++ b/sonic-bluestreak.love/game/modules/world/actors/floor.lua @@ -11,4 +11,19 @@ function Floor:update(dt) end +function Floor: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() +end + return Floor diff --git a/sonic-bluestreak.love/game/modules/world/actors/parent.lua b/sonic-bluestreak.love/game/modules/world/actors/parent.lua index ee81b78..87132fc 100644 --- a/sonic-bluestreak.love/game/modules/world/actors/parent.lua +++ b/sonic-bluestreak.love/game/modules/world/actors/parent.lua @@ -16,7 +16,13 @@ function Parent:draw() 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) + 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() end diff --git a/sonic-bluestreak.love/game/modules/world/maps/shoot.lua b/sonic-bluestreak.love/game/modules/world/maps/shoot.lua index ab719dd..b95a801 100644 --- a/sonic-bluestreak.love/game/modules/world/maps/shoot.lua +++ b/sonic-bluestreak.love/game/modules/world/maps/shoot.lua @@ -49,7 +49,10 @@ end function ShootMap:loadCollisions() self:loadLayout(); local w, h = self:getDimensions() - self.world:newCollision("floor", 0, 0, -16, w, h, 16) + --self.world:newCollision("floor", 0, 0, -16, w, h, 16) + for i, chunk in ipairs(self.layout) do + chunk:spawnGrounds((i-1)*31*8) + end end function ShootMap:loadLayout() @@ -242,7 +245,7 @@ function ShootMap:drawChunks(x) for i=1, 6 do local chunkID = firstChunk + i if (self.layout[chunkID] ~= nil) then - self.layout[chunkID]:draw(chunkID * (8*31)) + self.layout[chunkID]:draw((chunkID-1) * (8*31)) end end end diff --git a/sonic-bluestreak.love/game/modules/world/maps/tools/chunk.lua b/sonic-bluestreak.love/game/modules/world/maps/tools/chunk.lua index 2bafeb9..fb316ff 100644 --- a/sonic-bluestreak.love/game/modules/world/maps/tools/chunk.lua +++ b/sonic-bluestreak.love/game/modules/world/maps/tools/chunk.lua @@ -19,6 +19,16 @@ function Chunk:update(dt) end +function Chunk:spawnGrounds(x) + for i=1, 5 do + for j=1, 8 do + if (self.data.terrain[i][j] ~= 3) then + self.map.world:newCollision("floor", x+(j-1)*31, (i-1)*20, -48, 31, 20, 48) + end + end + end +end + function Chunk:draw(x) for i=1, 5 do for j=1, 8 do