:D I found a way, I don't think it has been posted (if it is I look stupid :L )
This code will update the gravity on every enterFrame (should probably change that to a timer every second) to the variable grav.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | grav = 1 function gravi() print(grav) grav = 10 print(grav) end timer.performWithDelay(5000,gravi) --]] physics = require( "physics" ) physics.start() function checkgrav() gx, gy = physics.getGravity() print(gx, gy) physics.setGravity( 0, grav) end Runtime:addEventListener( "enterFrame", checkgrav ) |
Did you get a look at this sample?
http://developer.anscamobile.com/content/shape-tumbler