huller: a tool to generate a collision shape from an image

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
clofresh
Citizen
Posts: 87
Joined: Sun Jul 26, 2009 4:21 pm
Contact:

huller: a tool to generate a collision shape from an image

Post by clofresh » 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:

Code: Select all

./huller path/to/sprite.png > sprite.lua
And then in your game you can do (assuming you're using HC):

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
----------------------------------------
Sluicer Games

Post Reply

Who is online

Users browsing this forum: FloatingBanana and 4 guests