Hi Guys.
new to Corona.
Loving it so far.
though still have some problems getting the Remote to work.
I get the connection but nothing happens.
The idea is to control the soccer ball. like “floating”
___________________________________________________________
local physics = require(“physics”)
physics.start()
physics.setScale( 60 )
physics.setGravity( 0, 9.8)
– Load The Remote
local remote = require(“remote”)
– Start The Remote On Port 8080
remote.startServer( “8080” )
system.setAccelerometerInterval( 100 ) – set accelerometer to maximum responsiveness
function onTilt( event )
physics.setGravity( ( 9.8 * event.xGravity ), ( -9.8 * event.yGravity ) )
end
Runtime:addEventListener( “accelerometer”, onTilt )
function updateAccelerometer()
– This Runtime Listener Is An Example Of How To
– Access The Remote You Can Query remote.xGravity
– Or Any Other Value From Anywhere In Your Application
local xGravity = remote.xGravity
local yGravity = remote.yGravity
local zGravity = remote.zGravity
local xInstant = remote.xInstant
local yInstant = remote.yInstant
local zInstant = remote.zInstant
local isShake = remote.isShake
– Only Use If Compass Activated And Running v1.1 Or Later
local magnetic = remote.magnetic
– Print xGravity To Terminal
print( remote.xGravity )
end
display.setStatusBar( display.HiddenStatusBar )
local bkg = display.newImage( “foto.JPG” )
local soccerball = display.newImage(“soccer_ball.png”)
soccerball.x = 160; soccerball.y = 200
borderBodyElement = { friction=0.3, bounce=0.3 }
local borderTop = display.newRect( 0, 0, 320, 20 )
borderTop:setFillColor( 200, 0, 0, 255) – make invisible
physics.addBody( borderTop, “static”, borderBodyElement )
local borderBottom = display.newRect( 0, 460, 720, 20 )
borderBottom:setFillColor( 200, 40, 10, 255) – make invisible
physics.addBody( borderBottom, “static”, borderBodyElement )
local borderLeft = display.newRect( 0, 20, 20, 460 )
borderLeft:setFillColor( 200, 40, 10, 255) – make invisible
physics.addBody( borderLeft, “static”, borderBodyElement )
local borderRight = display.newRect( 300, 20, 20, 460 )
borderRight:setFillColor( 200, 0, 0, 255) – make invisible
physics.addBody( borderRight, “static”, borderBodyElement )
physics.addBody( soccerball, { density=0.9, friction=0.5, bounce=0.0, radius=38 } )
_____________________________________________________________________
Hope you can help.
Thanks.
Jimmi [import]uid: 51793 topic_id: 8775 reply_id: 308775[/import]