huller: a tool to generate a collision shape from an image
Posted: Tue Sep 06, 2016 1:10 am
Hello,
I wrote a small command line tool called huller to generate a collision shape from an image: https://github.com/clofresh/huller
The idea is to generate the collision shape outside of your game like this:
And then in your game you can do (assuming you're using HC):
I wrote a small command line tool called huller to generate a collision shape from an image: https://github.com/clofresh/huller
The idea is to generate the collision shape outside of your game like this:
Code: Select all
./huller path/to/sprite.png > sprite.lua
Code: Select all
HC = require('HC')
function love.load()
spriteShapeData = require('sprite')
sprite = {
image = love.graphics.newImage('path/to/sprite.png'),
shape = HC.polygon(unpack(spriteShapeData)),
}
end
function love.draw()
sprite.shape:draw()
love.graphics.draw(sprite.image)
end