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 » Mon May 07, 2012 2:00 pm

How to make collision?

User avatar
Refpeuk
Citizen
Posts: 91
Joined: Wed Dec 14, 2011 6:16 pm

Re: Collision detection

Post by Refpeuk » Mon May 07, 2012 2:08 pm

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 » Mon May 07, 2012 2:18 pm

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 » Mon May 07, 2012 2:34 pm

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: 819
Joined: Sat Dec 10, 2011 7:18 pm

Re: Collision detection

Post by veethree » Mon May 07, 2012 6:47 pm

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 » Mon May 07, 2012 8:54 pm

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 » Tue May 08, 2012 4:14 pm

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 » Wed Jul 18, 2012 11:20 pm

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: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Collision detection

Post by Nixola » Wed Jul 18, 2012 11:28 pm

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 » Thu Jul 19, 2012 12:21 am

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: Google [Bot] and 25 guests