Collision detection

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.
magreidis
Prole
Posts: 8
Joined: Sat May 05, 2012 3:32 pm

Collision detection

Post by magreidis »

How to make collision?
User avatar
Refpeuk
Citizen
Posts: 91
Joined: Wed Dec 14, 2011 6:16 pm

Re: Collision detection

Post by Refpeuk »

Depends on the kind/complexity you want. Probably best is to use http://vrld.github.com/HardonCollider/
It was the best of times, it was the worst of times . . .
magreidis
Prole
Posts: 8
Joined: Sat May 05, 2012 3:32 pm

Re: Collision detection

Post by magreidis »

I want really simple collision that is just a wall
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: Collision detection

Post by mickeyjm »

Collision detection can be quite complicated depending on what you are doing, could you either give us a .love or expain the collison detector needed (i.e. is it a gridaligned rectangle colliding with a grid aligned rectangle or a point collideing with a rectangle or non grid aligned rectangles colliding etc)
Your screen is very zoomed in...
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Re: Collision detection

Post by veethree »

Best way to do collision is using the handy search function on the forums. There are plenty of topics here on collision detection.
User avatar
Puzzlem00n
Party member
Posts: 171
Joined: Fri Apr 06, 2012 8:49 pm
Contact:

Re: Collision detection

Post by Puzzlem00n »

I agree with the others. If you want collisions, you need to describe more to us, like what is colliding with the wall in the first place.
I LÖVE, therefore I am.
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: Collision detection

Post by Kasperelo »

What about:

Code: Select all

if player.x >= wall.x - player.sprite:getWidht() then
    player.x = wall.x - player.sprite:getWidht()
end

That does work for me.
LaserGuns
Prole
Posts: 33
Joined: Sun Apr 29, 2012 12:55 am

Re: Collision detection

Post by LaserGuns »

Kasperelo wrote:What about:

Code: Select all

if player.x >= wall.x - player.sprite:getWidht() then
    player.x = wall.x - player.sprite:getWidht()
end

That does work for me.
Why doesn't your avatar say "obey"? Banned from forums. lol
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Collision detection

Post by Nixola »

LaserGuns wrote:Why doesn't your avatar say "obey"? Banned from forums. lol
Why don't you have an avatar that says "obey"? ;)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
LaserGuns
Prole
Posts: 33
Joined: Sun Apr 29, 2012 12:55 am

Re: Collision detection

Post by LaserGuns »

Nixola wrote:
LaserGuns wrote:Why doesn't your avatar say "obey"? Banned from forums. lol
Why don't you have an avatar that says "obey"? ;)
Uh... well... SHUT UP lol
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 66 guests