Hi all,
I’m just getting started with Corona and cant seem to find a solution to this problem…
Basically I want the ground in a physics demo to have a curve in it (all the demos are flat) I therefore have edited the ground.png and also created a mask (ground_mask.png) and applied it to the ground.
Yet it still treats the ground as a flat square object??
I looked at the project using physics.setDrawMode( “debug” ) and the image is just a solid box.
Is there a way i can turn the ground into a curve e.g. using the alpha channel on a .png instead of a box?
This is what i have so far…
-- create a mask for the ground
local groundmask = graphics.newMask( "ground\_mask.png" )
--Add the ground
local ground = display.newImage( "ground.png" )
ground.x = 160; ground.y = 368
-- add the mask to ground
ground:setMask( groundmask )
--move the mask so it matches the ground png
ground.groundmaskX = ground.contentWidth\*0.5
ground.groundmaskY = ground.contentHeight\*0.5
-- add hit test to ground to take into accound mask
ground.isHitTestMasked = true
--add physiics to the ground
physics.addBody( ground, "static", { friction=0.1 } )
--Add the crate
local crate = display.newImage( "crate.png" )
crate.x = 90; crate.y = 90
physics.addBody( crate, { density=3.0, friction=0.4, bounce=0.2 } )
Any pointers appreciated Im sure i must be missing something here…
Thanks
[import]uid: 225935 topic_id: 35949 reply_id: 335949[/import]