lua - how to prevent a ball from floating over the ground in corona sdk -
i have image (ground) transparent pixels on top of since ground has hills ups , downs ... problem ball isn't moving down , according hills ... ball floating on image. can ??
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 } )
when add body image has transparency , not automatically make body image itself.
you can use tool physics body
http://www.codeandweb.com/physicseditor
http://www.codeandweb.com/blog/2012/05/24/getting-started-with-coronasdk-and-physicseditor-tutorial
to view actual physics body can add code
physics.setdrawmode("hybrid")
Comments
Post a Comment