1

I have an image (ground) with transparent pixels on top of it since the ground has hills like ups and downs ... the problem is that the ball isn't moving down and up according to the hills ... the ball is just floating over the image. what can I do ??

local bg2 = display.newImage("images/ground.png",true)
bg2:setReferencePoint(display.CenterLeftReferencePoint)
bg2.x = 0; bg2.y = _H/1.25;

local physics = require("physics")
physics.start()

local redOrb = display.newCircle( 0, 0, 25)
redOrb:setFillColor(255,0, 0)
physics.setGravity(0,9.8)
redOrb.x = 180; redOrb.y = 190; redOrb.rotation = 5

physics.addBody( bg2, "static", { friction=0.5, bounce=0.3 } )
physics.addBody( redOrb, { density=3.0, friction=0.5, bounce=0.3 } )
4

1 回答 1

2

当您将主体添加到具有透明度的图像时,它不会自动将主体作为图像本身。

您可以将此工具用于物理体

http://www.codeandweb.com/physicseditor

http://www.codeandweb.com/blog/2012/05/24/getting-started-with-coronasdk-and-physicseditor-tutorial

要查看实际的物理体,您可以添加此代码

physics.setDrawMode("hybrid")
于 2013-08-10T13:51:46.557 回答