summaryrefslogtreecommitdiff
path: root/liquidSurface.lua
diff options
context:
space:
mode:
Diffstat (limited to 'liquidSurface.lua')
-rw-r--r--liquidSurface.lua22
1 files changed, 19 insertions, 3 deletions
diff --git a/liquidSurface.lua b/liquidSurface.lua
index 6d9b24e..da79d44 100644
--- a/liquidSurface.lua
+++ b/liquidSurface.lua
@@ -2,7 +2,7 @@ local LiquidSurface = {}
LiquidSurface.__index = LiquidSurface
local DEFAULT_COLORS = {
- water = { 0.35, 0.65, 1, 0.75 },
+ water = { 0.35, 0.65, 1, 0.5},
lava = { 1, 0.35, 0.1, 0.8 }
}
@@ -146,9 +146,8 @@ function LiquidSurface:update(dt)
end
end
-function LiquidSurface:draw()
+function LiquidSurface:drawFill()
love.graphics.setColor(self.color)
-
for i = 2, self.columnsLength do
local p1x = self.x + (i - 2)
local p1y = self.bottomY - self.columns[i - 1].height
@@ -162,8 +161,25 @@ function LiquidSurface:draw()
p3x, p3y, p4x, p4y, p2x, p2y
)
end
+end
+function LiquidSurface:drawLine()
+ local linePoints = {}
+ for i = 1, self.columnsLength do
+ linePoints[#linePoints + 1] = self.x + (i - 1)
+ linePoints[#linePoints + 1] = self.bottomY - self.columns[i].height
+ end
love.graphics.setColor(1, 1, 1, 1)
+ love.graphics.setLineWidth(1)
+ love.graphics.setLineStyle("rough")
+ love.graphics.line(linePoints)
+ love.graphics.setLineStyle("smooth")
+ love.graphics.setColor(1, 1, 1, 1)
+end
+
+function LiquidSurface:draw()
+ self:drawFill()
+ self:drawLine()
end
return LiquidSurface