Routine for moving a image using gravity

Good day to all;

I recently buyed the Codify App for iPad and trying to programming a routine for moving a image using gravity(moving the iPad with no touch) but i can’t found a function that help me with that.

Note: The Gravity class using Gravity.x, Gravity.y and Gravity.z don’t move the image or maybe i not using a correctly way to use.

Greetings and thanks in advance
WEPV

Are you aware that the Gravity parameters are values between -1 and 1? So if you need to move it by a noticeable difference, multiply it. Are you using a variable to track the image’s position? Here is some code which might explain it to you:

function setup()
    x = WIDTH / 2
    y = HEIGHT / 2
end

function draw()
    x = x + Gravity.x * 30
    y = y + Gravity.y * 30
    sprite("Planet Cute:Character Boy", x, y)
end

Hello Jordan;

The example that you provide is excellent, i tested and worked for me.

Thanks