Reputation: 851
How can i turn on and off the "physics.addBody" on my "bar" object?
If i try:
physics.pause(bar, "static", {density=.1, bounce=.5, friction=.2,filter=barCosllisionFilter } )
All physics pause
bar object:
bar = display.newSprite( BARimageSheet, BARsequenceData1)
bar.x = display.contentWidth/2
bar.y = display.contentHeight/2
bar:play()
bar.collided = true
bar.name = "bar"
bar.gravityScale = 0.0
physics.addBody(bar, "static", {density=.0, bounce=.5, friction=.2,filter=barCosllisionFilter } )
bar.isVisible = true-- false
bar.isFixedRotation=true
screenGroup:insert(bar)
Upvotes: 0
Views: 65
Reputation: 1006
Try this to turn it off:
--change the bar body's active state to false
bar.isBodyActive = false
To turn it on again, just set the property back to true.
Upvotes: 2