Thanks! I managed to figure it out.
Now I’ve run into a different issue. I’m following the directions to place invisible walls around the screen, to keep the balloons from floating off the screen. The code provided only makes the walls and ceiling cover half the screen, so the balloons are still flying away.
Do you know a better way to make the invisible walls cover the entire borders? Sorry if I’m a pain in the ass. I’m just really trying my best to learn and understand the language.
Here’s the code to create invisible borders:
–[[ Create “walls” on the left, right and ceiling to keep balloon on screen
display.newRect(x coordinate, y coordinate, x thickness, y thickness)
So the walls will be 1 pixel thick and as tall as the stage
The ceiling will be 1 pixel thick and as wide as the stage
–]]
local leftWall = display.newRect (0, 0, 1, display.contentHeight);
local rightWall = display.newRect (display.contentWidth, 0, 1, display.contentHeight);
local ceiling = display.newRect (0, 0, display.contentWidth, 1);
– Add physics to the walls. They will not move so they will be “static”
physics.addBody (leftWall, “static”, { bounce = 0.1 } );
physics.addBody (rightWall, “static”, { bounce = 0.1 } );
physics.addBody (ceiling, “static”, { bounce = 0.1 } );