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

Discussion in 'iOS Programming' started by chrono1081, Mar 31, 2011.

  1. chrono1081, Mar 31, 2011
    Last edited: Mar 31, 2011

    chrono1081 macrumors 604


    Jan 26, 2008
    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:

     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.

    --Add physics engine and apply gravity
    local physics = require("physics")
    --Set gravity to act "down"
    physics.setGravity(0, 9.8)
    --Hide status bar
    --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")

    Attached Files:

    • pic.png
      File size:
      17.4 KB

Share This Page