Collision Help

If this is the code I’m using to move my object:

[lua] local moveObj = function(e)
if e.phase == “moved” then
slBumper02.y = e.y
end
end

slBumper02:addEventListener(“touch”, moveObj)[/lua]

What code would I need to use to make is stop moving when it collides with:

[lua] local tWall = display.newImage(“HoriWall.png”)
tWall.y = -5
physics.addBody(tWall, “static”, {bounce = 0})
localGroup:insert(tWall)[/lua] [import]uid: 208120 topic_id: 34812 reply_id: 334812[/import]

We don’t know enough about slBumper02 to really answer this. Is it a physics object? Is it static? Dynamic? What have you setup if anything for managing the collision detection events?

[import]uid: 199310 topic_id: 34812 reply_id: 138403[/import]

Sorry, very new to this lol

[lua] local slBumper02 = display.newImage(“SliderBumper.png”)
slBumper02.x = 304
slBumper02.y = 240
physics.addBody(slBumper02, “static”, {bounce = 1})
localGroup:insert(slBumper02)[/lua]

I hope this is what you are talking about. [import]uid: 208120 topic_id: 34812 reply_id: 138433[/import]

Hi @Wooderson,
Don’t worry about being new to this, everybody starts at the beginning at some point. :wink:

First, read this guide… thoroughly! It’s a bit long, but don’t skim it because it contains a bunch of information.
http://developer.coronalabs.com/content/game-edition-collision-detection

Then, try to implement what’s within. If you still have questions, let me know.

Best regards,
Brent [import]uid: 200026 topic_id: 34812 reply_id: 138435[/import]

Okay, Thanks Brent :slight_smile: [import]uid: 208120 topic_id: 34812 reply_id: 138649[/import]

We don’t know enough about slBumper02 to really answer this. Is it a physics object? Is it static? Dynamic? What have you setup if anything for managing the collision detection events?

[import]uid: 199310 topic_id: 34812 reply_id: 138403[/import]

Sorry, very new to this lol

[lua] local slBumper02 = display.newImage(“SliderBumper.png”)
slBumper02.x = 304
slBumper02.y = 240
physics.addBody(slBumper02, “static”, {bounce = 1})
localGroup:insert(slBumper02)[/lua]

I hope this is what you are talking about. [import]uid: 208120 topic_id: 34812 reply_id: 138433[/import]

Hi @Wooderson,
Don’t worry about being new to this, everybody starts at the beginning at some point. :wink:

First, read this guide… thoroughly! It’s a bit long, but don’t skim it because it contains a bunch of information.
http://developer.coronalabs.com/content/game-edition-collision-detection

Then, try to implement what’s within. If you still have questions, let me know.

Best regards,
Brent [import]uid: 200026 topic_id: 34812 reply_id: 138435[/import]

Okay, Thanks Brent :slight_smile: [import]uid: 208120 topic_id: 34812 reply_id: 138649[/import]