local fisica = require(“physics”)
physics.start()
system.activate(“multitouch”)
physics.setGravity(0,9.8)
local fondo display.newImage (“fondo.png”)
local suelo = display.newImage (“suelo.png”)
suelo:setReferencePoint( display.BottomLeftRferencePoint)
suelo.x, suelo.y = 160, 470
local paredIz = display.newRect( 2, -0, 1, 480 )
physics.addBody (paredIz, “static”, {friction = 1.0, density=1.0, bounce=0})
local paredDer = display.newRect( 319, -0, 1, 480 )
physics.addBody (paredDer, “static”, {friction = 1.0, density=1, bounce=0})
local bola = display.newCircle( 100, 100, 20 )
physics.addBody (bola, {friction = 0.3, density=1, bounce=0.8, radius=20 })
local sueloForma = {-240,-20, 240, -20, 240, 20, -240, 20}
physics.addBody (suelo, “static”, {friction = 1.0, density=1.0, bounce=0, shape= sueloForma})
function moveBola( event )
if event.phase == “began” then
display.getCurrentStage( ):setFocus(bola)
elseif event.phase == “ended” then
bola:applyLinearImpulse(event.xStart - event.x, event.yStart - event.y, bola.x, bola.y)
display.getCurrentStage( ):setFocus(nil)
end
end
bola:addEventListener( “touch”, moveBola)
Well i try to use this function from this video but i cant make this work, i am new in lua. probably this its really easy, but pls some one can help me?, i need to do a shot like angry birds.
NOW ITS WORKING!
ALL ITS OK
Thanks!