I am 16 and started coding now only (inspiration = steve jobs) so i came to corona for help and i learn lil bit of codes like local background…function onTouch…etc but then i came to know that corona already have some samples game so i open many but found a app with little coding whos name is chains and here is the coding:-
local centerX = display.contentCenterX
local centerY = display.contentCenterY
local _W = display.contentWidth
local _H = display.contentHeight
local physics = require(“physics”)
physics.start()
physics.setScale( 60 )
display.setStatusBar( display.HiddenStatusBar )
– The final “true” parameter overrides Corona’s auto-scaling of large images
local background = display.newImage( “grille_bkg.png”, centerX, centerY, true )
local ground = display.newImage( “ground.png”, centerX, 450, true )
physics.addBody( ground, “static”, { friction=0.5 } )
local beam1 = display.newImage( “beam.png” )
beam1.x = 20; beam1.y = 350; beam1.rotation = -40
physics.addBody( beam1, “static”, { friction=0.5 } )
local beam2 = display.newImage( “beam.png” )
beam2.x = 410; beam2.y = 340; beam2.rotation = 20
physics.addBody( beam2, “static”, { friction=0.5 } )
local beam3 = display.newImage( “beam_long.png” )
beam3.x = 280; beam3.y = 50
physics.addBody( beam3, “static”, { friction=0.5 } )
local myJoints = {}
for i = 1,5 do
local link = {}
for j = 1,17 do
link[j] = display.newImage( “link.png” )
link[j].x = 121 + (i*34)
link[j].y = 55 + (j*17)
physics.addBody( link[j], { density=2.0, friction=0, bounce=0 } )
– Create joints between links
if (j > 1) then
prevLink = link[j-1] – each link is joined with the one above it
else
prevLink = beam3 – top link is joined to overhanging beam
end
myJoints[#myJoints + 1] = physics.newJoint( “pivot”, prevLink, link[j], 121 + (i*34), 46 + (j*17) )
end
end
local randomBall = function()
ball = display.newImage( “super_ball.png” )
ball.x = 10 + math.random( 60 ); ball.y = -20
physics.addBody( ball, { density=2.9, friction=0.5, bounce=0.7, radius=24 } )
end
– Call the above function 12 times
timer.performWithDelay( 1500, randomBall, 12 )
this is the sample code aND I want to understand it therefore i read it so somehow i understood till
local beam3 = display.newImage( “beam_long.png” )
beam3.x = 280; beam3.y = 50
physics.addBody( beam3, “static”, { friction=0.5 } )
but after that nothing so please anyone help me to understand and dont put silly links below…tell me please!!!