here is the main code -
\_H = display.contentHeight
\_W = display.contentWidth
letSize = 32
letRadius = 3
frameOffset = 100
display.setStatusBar( display.HiddenStatusBar ) -- hide the status bar
local physics = require( "physics" )
physics.start( true ) -- prevent all bodies from sleeping
--physics.start( false ) -- default behavior; bodies may sleep
physics.setDrawMode( "debug" ) -- shows collision engine outlines only
--physics.setDrawMode( "hybrid" ) -- overlays collision outlines on normal Corona objects
--physics.setDrawMode( "normal" ) -- the default Corona renderer, with no collision outline
local bottom = display.newLine( 2, \_H, \_W, \_H )
bottom.width = 5
bottom.myName = "bottom"
bottom:setColor( 255, 102, 102, 255 )
physics.addBody( bottom, "static", { friction=0.5, bounce=0.3 } )
local line = display.newLine( 150, \_H - 50, \_W - 150, \_H - 50)
line.width = 5
line.myName = "line"
line:setColor( 255, 102, 102, 255 )
physics.addBody( line, "static", { friction=0.5, bounce=0.3 } )
local letA = display.newText("", 30, 30, native.systemFont, 0)
letA:setTextColor(170, 170, 170)
letA.text = "A"
letA.myName = "A"
letA.size = letSize
physics.addBody( letA, "dynamic", { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius } )
local letB = display.newText("", 70, 30, native.systemFont, 0)
letB:setTextColor(170, 170, 170)
letB.text = "B"
letB.myName = "B"
letB.size = letSize
physics.addBody( letB, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )
local letC = display.newText("", 110, 30, native.systemFont, 0)
letC:setTextColor(170, 170, 170)
letC.text = "C"
letC.myName = "C"
letC.size = letSize
physics.addBody( letC, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )
local letD = display.newText("", 150, 30, native.systemFont, 0)
letD:setTextColor(170, 170, 170)
letD.text = "D"
letD.myName = "D"
letD.size = letSize
physics.addBody( letD, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )
local letE = display.newText("", 190, 30, native.systemFont, 0)
letE:setTextColor(170, 170, 170)
letE.text = "E"
letE.myName = "E"
letE.size = letSize
physics.addBody( letE, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )
local letF = display.newText("", 230, 30, native.systemFont, 0)
letF:setTextColor(170, 170, 170)
letF.text = "F"
letF.myName = "F"
letF.size = letSize
physics.addBody( letF, { density = 1.0, friction = 0.3, bounce = 0.2, radius = letRadius} )
local function onLocalCollision( self, event )
if ( event.phase == "began" ) then
-- print( self.myName .. ": collision began with " .. event.other.myName )
elseif ( event.phase == "ended" ) then
-- print( self.myName .. ": collision ended with " .. event.other.myName )
end
end
here is the build.settings code -
settings =
{
orientation =
{
default = "landscapeRight",
supported =
{
"landscapeLeft", "landscapeRight",
},
},
iphone =
{
plist =
{
UIInterfaceOrientation = "landscapeRight",
UISupportedInterfaceOrientations =
{
"landscapeRight",
"landscapeLeft",
},
CFBundleIconFile = "Icon.png",
CFBundleIconFiles = {
"Icon.png" ,
"Icon@2x.png" ,
"Icon-72.png" ,
"Icon-Small-50.png" ,
"Icon-Small.png" ,
"Icon-Small@2x.png"
},
CFBundleDisplayName = "SVG Test",
UIPrerenderedIcon = true,
UIStatusBarHidden = true,
UIApplicationExitsOnSuspend = true,
},
},
}
now take turns commenting out the debug drawmode and then normal drawmode.
example,
first
physics.setDrawMode( “debug” )
–physics.setDrawMode( “normal” )
second
–physics.setDrawMode( “debug” )
physics.setDrawMode( “normal” )
You will notice that in DEBUG draw mode the lines extend to left side of screen.
Where as,
you will notice that in normal draw mode the lines adhere to the coordinates in the display.newline code.
I think the debug mode is ignoring my global _W & _H variables that I have setup
to determine content width & height(see top two lines of code).
[import]uid: 11094 topic_id: 14935 reply_id: 78127[/import]