Touch and drop

Hey.  Just wanted to point out this code won’t work because you’re testing for the same condition twice:

local function grenadeTouch( event ) if event.phase == "ended" then -- ONLY THIS CONDITION WILL EXECUTE elseif event.phase == "ended" then -- SAME AS LAST CONDITION end end

How ‘thick’ is the floor.  If it is very thin you could be tunneling.

when you add the bodies to the grenades, set ‘isBullet’ to true.

Your code should look like this:

physics.addBody( grenade1, "dynamic", {density=3.0, friction=0.5, bounce=0.3, radius=12.5} ) grenade1.isBullet = true

 physics.addBody(theFloor, "kinematic", {density=.1, bounce=0.2, friction=.2})

Finally, be sure you’re NOT changing the x or y position of any groups.

Bodies in misaligned groups will not work as expected.

If this doesn’t work you’ll need someone to look at your entire game.

Thanks I fixed that already .

The floor is an image . It’s an invisible tile . I tried putting theFloor to kinematic but that didn’t change anything

have you turned on hybrid drawMode() to verify the bodies visually.

also, you’re not understanding.  What is the dimension of the floor object (width and height)

480 x 25

No I didn’t try to turn that mode on .

I have it on an example project and it works just fine 

Hey.  I gotta take off.  So i’ll just say:

Turn on hybrid mode and verify your bodies are where they should be.  

After that, just keep plugging away.  Take a break, then look at the code again.  The problem may just pop out at you.

I turned on hybrid mode, when I click on the grenade the get light a green light on them 

I just tried this code and still there is no floor :

 floor = display.newRect(layers.overlay, 0, 347, 480, 25) physics.addBody (floor, "static", {bounce = 0.0, friction = 2})

I also tried moving the addBody and still no results .

I have this code and there is still not floor 

    floor = display.newRect(layers.overlay, 0, 347, 480, 25) 

What do you mean there is no floor?

What is your config.lua?

Are you adding a physics body to the floor?

Is a box with a top left corner of 0,347 and a bottom right corner of 480, 372 on screen or off screen?

Have you turned on the physics draw mode to hybrid to see your physics bodies?

Rob

config.lua :

application = { content = { width = 320, height = 480, scale = "zoomStretch", }, }

I already tried adding a physics body to the floor and that didn’t change anything .

It’s suppose to be at the bottom on the screen not in sight .

I did not turn on the physics draw mode to hybrid to see your physics bodies

You might want to put it on screen so you can see it to make sure it works then move it off screen as soon as you have it working.

Rob