如何在corona sdk中制作特定的物理主体在移动动画中?

我在我的 Corona SDK 游戏中有一个名为“instance1”的动画,包含 8 帧。不幸的是,我尝试添加的动态物理体会将剩余动画中的透明空间捕捉到,并且当 instance1 跳到平台上时,它会因透明空间而飞出屏幕。有没有一种方式只将物理体设置为当前帧的不透明颜色? 以下是代码:

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 } )

感谢任何帮助。

点赞
用户3811832
用户3811832

如果您不定义,身体将创建一个与您的图像相等的正方形。 尝试设置身体的顶点,使其完全按照您的要求进行工作。

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 } )
2015-08-20 07:57:51