Hi,
I’m a starter in corona projects, trying to do my first project i had a surprise, the walls was not fit in the screen as it should and as i saw in the videos tutorials and as it is written in the tutorials in the net.
the code that i copied and the results were not the expected
i just doesn´t know why the command rect not fit the rectangle in the screen edges
what am i doing wrong? some configuration in config? the image is attached
Code:
local physics = require(“physics”)
physics.start()
physics.setGravity(0,5)
display.setStatusBar( display.HiddenStatusBar )
local fundo = display.newImageRect( “Desert.png”, 320, 480 )
fundo.x = 160
fundo.y = 240
local bola = display.newImageRect( “Icon.png”, 57, 57 )
bola.x = 112
bola.y = 117
physics.addBody(bola)
local topWall = display.newRect( 0, 0, display.contentWidth, 10 )
local bottomWall = display.newRect( 0, display.contentHeight - 10, display.contentWidth, 10 )
local leftWall = display.newRect( 0, 0, 10, display.contentHeight )
local rightWall = display.newRect( display.contentWidth - 10, 0, 10, display.contentHeight )
– make them physics bodies
physics.addBody(topWall, “static”, {density = 1.0, friction = 0, bounce = 1, isSensor = false})
physics.addBody(bottomWall, “static”, {density = 1.0, friction = 0, bounce = 1, isSensor = false})
physics.addBody(leftWall, “static”, {density = 1.0, friction = 0, bounce = 1, isSensor = false})
physics.addBody(rightWall, “static”, {density = 1.0, friction = 0, bounce = 1, isSensor = false})