PDA

View Full Version : SOLVED: Any Corona SDK users out there able to help me?




chrono1081
Mar 31, 2011, 08:51 PM
SOLVED: I should have watched through the second video. There is a property that allows you to change the bounding boxes, they don't scale automatically (at least not that I have found).

Incase anyone runs into something similar, when you make physics bodies try this:

physics.addBody(objectName, {radius = var})

There is supposedly a more accurate way but I haven't found that video yet. Bounding circles are faster usually anyway though.




Hi guys,

I tried looking this up on the Corona SDK threads but I am not allowed to post there for some reason (maybe because I am using the trial).

I'm following along in the Balloon Pop tutorial and have a problem. I am scaling my balloon graphic but it does not update the bounding box, so if I scale my balloon, when it hits the bottom the balloon hovers over the floor if it is scaled. I couldn't find any way to change the bounding box and make it update. (I included a picture). Below is my code, does anyone have any suggestions how to work around this?

That white bar is the ground by the way.


--Add physics engine and apply gravity
local physics = require("physics")
physics.start()

--Set gravity to act "down"
physics.setGravity(0, 9.8)

--Hide status bar
display.setStatusBar(display.HiddenStatusBar)

--Background image
local background = display.newImage("city.png")

--Centers for the screen
local centerX = display.stageWidth/2
local centerY = display.stageHeight/2

--Add balloon to stage, scale and position
local balloon = display.newImage("balloon.png")
balloon.x = centerX
balloon.xScale = 0.75
balloon.yScale = 0.75

--Add balloon as a physics body
physics.addBody(balloon, {bounce = 0.2})

--Add floor to stage and position
local floor = display.newImage("floor.png")
floor.y = display.contentHeight - floor.stageHeight/2

--Add floor as a physics body
physics.addBody(floor, "static")