HardonCollider Error: attempt to call method 'addRectangle' (a nil value)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
0x80
Prole
Posts: 2
Joined: Tue Feb 16, 2016 6:48 pm

HardonCollider Error: attempt to call method 'addRectangle' (a nil value)

Post by 0x80 » Tue Feb 16, 2016 6:55 pm

As i do not want to implement my own collision detection algorithm, i have found a HardonCollider library to do the heavy lifting for me.

I have followed the example code of the library but got an error even with a basic setup.

Code: Select all

    local hc  = require "hardoncollider"

    local hero
    local collider

    function on_collision(dt, shape_a, shape_b, mtv_x, mtv_y)

    end

    function love.load(arg)
        collider = hc(100, on_collision)
        hero = collider:addRectangle(30,30,16,16)
    end
Running this code will throw the following error message:

Code: Select all

PS C:\dev\love-0.10.0-win64> Error: main.lua:12: attempt to call method 'addRectangle' (a nil value)
stack traceback:
        main.lua:12: in function 'load'
        [string "boot.lua"]:437: in function <[string "boot.lua"]:433>
        [C]: in function 'xpcall'
I have been investigating the problem, but did not find any solutions nor anybody else who faced this error.

User avatar
D0NM
Party member
Posts: 220
Joined: Mon Feb 08, 2016 10:35 am
Location: Zabuyaki
Contact:

Re: HardonCollider Error: attempt to call method 'addRectangle' (a nil value)

Post by D0NM » Tue Feb 16, 2016 10:32 pm

well. You use some outdated docs & samples...
There is no such method as addRectangle
HC has a new API... so, use some new sample from the url http://hc.readthedocs.org/en/latest/

Found it here search.php?keywords=HardonCollider ;)
Our LÖVE Gamedev blog Zabuyaki (an open source retro beat 'em up game). Follow @Zabuyaki.
Twitter @FaMeSoft / GP32 Free Platformer: SUPER PLUSHA
:joker: LÖVE & Lua Video Lessons in Russian / Видео уроки по LÖVE и Lua :joker:

0x80
Prole
Posts: 2
Joined: Tue Feb 16, 2016 6:48 pm

Re: HardonCollider Error: attempt to call method 'addRectangle' (a nil value)

Post by 0x80 » Wed Feb 17, 2016 5:11 pm

Thank you, i cannot believe i missed it ...

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 13 guests