I'm basically trying to get when the players shape collides with another shape, I guess the world collision callback does this but does it take any arguments? I couldn't see them in the documentation if it did and I've tried retrieving them manually, it seems it takes 2 arguments, but I cannot identify what they are.
Any help is appreciated
Using the world callback?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Using the world callback?
Ah, I've been documenting that today. (Not uploaded yet). I'm sorry the documentation isn't complete.
You basically do this:
The first two arguments is whatever data you set with shape:setData. The third is a Contact object with contact point data.
You basically do this:
Code: Select all
s1 = love.physics.newCircleShape( body1, 20 )
s1:setData("Shape 1")
s2 = love.physics.newCircleShape( body2, 20 )
s2:setData("Shape 2")
world:setCallback(collision)
function collision(a, b, c)
print(a .. " with " .. b)
end
Re: Using the world callback?
Ahh no problem
Saves me messing with metatables and loops to find out what the args were.
Now I can finally finish my first game
Saves me messing with metatables and loops to find out what the args were.
Now I can finally finish my first game
Re: Using the world callback?
Also is there a way of retrieving if any key is being pressed?
Re: Using the world callback?
Of course. love.keyboard.isDown. See constants for key symbols.
Re: Using the world callback?
You misunderstood - unless I'm missing something - I mean ANY key as in any of them. Of course I could loop through every key in there but that would be tedious.
One last question
Is there a velocity limit in the physics engine? My falling boxes of doom seem to not go past a certain speed.
One last question
Is there a velocity limit in the physics engine? My falling boxes of doom seem to not go past a certain speed.
Re: Using the world callback?
Any key:
EDIT: typo
Code: Select all
keynum = 0
function keypressed(k)
keynum = keynum + 1
end
function keyreleased(k)
keynum = keynum - 1
end
function isAnyKeyDown()
return keynum > 0
end
There is no limit that I'm aware of.conman420 wrote:Is there a velocity limit in the physics engine? My falling boxes of doom seem to not go past a certain speed.
EDIT: typo
Re: Using the world callback?
Correctme if I'm wrong, but wouldn't the keypressed() and keyreleased() callbacks do the trick too?
Teh Blog -> http://cryodreams.com.ar
Re: Using the world callback?
I think he wants to know if any key is down at any time.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 8 guests