Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chrono1081

macrumors G3
Original poster
Jan 26, 2008
8,922
6,640
Isla Nublar
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:

Code:
 physics.addBody(objectName, {[B]radius = var[/B]})

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.

Code:
--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")
 

Attachments

  • pic.png
    pic.png
    17.4 KB · Views: 156
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.