如何在电晕sdk的动画中制作特定的物理体?

时间:2015-08-19 15:03:49

标签: animation sdk lua corona physics

我有一个名为" instance1"在我的日冕sdk游戏中有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 } )

任何帮助表示感谢。

Mitra0000

1 个答案:

答案 0 :(得分:0)

如果你没有定义,身体将创建一个等于你的图像的方块。  尝试设置体顶点,使其完全按照您的需要工作

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 } )
相关问题