How to make a specific physics body in a moving animation in corona sdk? -
i have moving animation called "instance1" has 8 frames in corona sdk game. unfortunately dynamic physics body try add picks transparent space in rest of animation , when instance1 jumps on platform goes off of screen because of transparent space. there way set physics body current frame's opaque colour only? here code:
local sheet1 = graphics.newimagesheet( "runningcat.png", { width=496, height=206.5, numframes=8 } ) local instance1 = display.newsprite( sheet1, { name="cat", start=1, count=8, time=1000 } ) instance1.x = display.contentwidth / 4 + 10 instance1.y = baseline - 100 instance1.xscale = .3 instance1.yscale = .3 instance1:play() physics.addbody( instance1, { density=3.0, friction=0.5, bounce=0.3 } )
any appreciated.
mitra0000
if don't define, body create square equals image. try set body vertices make work want
local pentagonshape = { 0,-37, 37,-10, 23,34, -23,34, -37,-10 } physics.addbody( pentagon, { density=3.0, friction=0.8, bounce=0.3, shape=pentagonshape } )
Comments
Post a Comment