Corona SDK Ball Drag

时间:2018-03-21 21:36:52

标签: lua sdk corona

我正在使用Corona SDK创建一个游戏,我想将手指向下拖动到屏幕上,当我释放球时,它会从墙壁和挡块上弹起并反弹。我不知道怎么做,所以有人可以帮我吗?

这是我的球码:

ball = display.newImage("ball.png")
ball.x = 160
ball.y = 400
ball.rotation = 90
physics.addBody(ball, "static", {density=.1, bounce=0.1, friction=.2, radius=12})
ball:scale( 1, 1.2 )
gameGroup:insert(ball)

我的区块代码:

block = display.newImage("rectangle5.png")
block.x = 200
block.y = 100
block.rotation = 90
physics.addBody(block, "static", {density=.1, bounce=0.1, friction=.2, radius=12})
block:scale( 0.5, 0.7 )
gameGroup:insert(block)