Skip to content

totebo/defold-hc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Defold HC

Defold bindings for HardonCollider.

Installation

You can use Defold HC in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

https://github.com/totebo/defold-hc/archive/master.zip

Or point to the ZIP file of a specific release.

Example

local HC = require "hc.hardoncollider"

function init(self)

	-- Global collider
	local global_ball = HC.circle(100, 100, 20)
	local global_rect = HC.rectangle(110, 90, 20, 100)

	for shape, delta in pairs(HC.collisions(global_ball)) do
		shape:move(delta.x, delta.y)
	end

	-- Instanciated collider, if using more than one game world
	local collider = HC.new()

	local ball = collider:circle(100, 100, 20)
	local rect = collider:rectangle(110, 90, 20, 100)

	for shape, delta in pairs(collider:collisions(ball)) do
		shape:move(delta.x, delta.y)
	end

end

Refer to Hardon Collider reference for usage:

About

Defold HardonCollider

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages