What it does
physics2D.setGravity sets Gravity on a physics2D object. It takes x and y.
Signature
physics2D.setGravity(x, y)Arguments
xy
Example · generated
function update(dt) { physics2D.setGravity(100, 120);}physics2D.setGravity is called with values of the shape its signature asks for. The code sits in update(dt), which the engine calls every frame: dt is the time since the last one, in seconds.