love: added square grid example;added hex example

This commit is contained in:
2016-11-27 14:34:01 -07:00
parent 14a36ae366
commit dc86672f5a
2 changed files with 101 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
hex = {}
hex.centerX = 200
hex.centerY = 200
hex.size = 45
function love.draw()
love.graphics.setColor({255,255,255})
local lastX = nil
local lastY = nil
for i=0,6 do
local angle = 2 * math.pi / 6 * (i + 0.5)
local x = hex.centerX + hex.size * math.cos(angle)
local y = hex.centerY + hex.size * math.sin(angle)
if i > 0 then
love.graphics.line(lastX, lastY, x, y)
end
lastX = x
lastY = y
end
end