How do i tilt a ball round the screen?

ive tried so many code snippets and none of them are working… i have also tried the sample code called shapeTumbler but that doesnt seem to works to good for me… i want it to no really on phyics… i have this code that make the box go side to side but not move around fully on the screen…

local function onAccelerate( event ) if box.x \> display.contentWidth \* 0.1 and box.x \< display.contentWidth \* 0.9 then box.x = box.x + (event.xInstant) \* 100 end if box.x \> display.contentWidth \* 1 then box.x = display.contentWidth \* 0.97 end if box.x \< display.contentWidth \* 0 then box.x = display.contentWidth \* 0.03 end end Runtime:addEventListener( "accelerometer", onAccelerate )

Hi @SonicX278,

If that works on the X axis, shouldn’t adding in similar Y axis code accomplish your goal?

Brent

I tried but doesn’t seem to work… Maybe someone can test it?

What is your updated code?

Don’t have it with me… But when I did it was edited like this
1: all the x’s are y’s
2: all the contentWidth to contentHeight

That’s pretty much it…

so what i want is so no physics involved … the code above doesnt use physics…

OK, but did you duplicate all of the “x” stuff into “y” in addition?

Hi @SonicX278,

If that works on the X axis, shouldn’t adding in similar Y axis code accomplish your goal?

Brent

I tried but doesn’t seem to work… Maybe someone can test it?

What is your updated code?

Don’t have it with me… But when I did it was edited like this
1: all the x’s are y’s
2: all the contentWidth to contentHeight

That’s pretty much it…

so what i want is so no physics involved … the code above doesnt use physics…

OK, but did you duplicate all of the “x” stuff into “y” in addition?