Sprite not moving with orientation sensor

Im making an app in which you move your character left to right using the orientation sensor, ive tried searching for different ways to move it on youtube no solutions asked my friends they dont know


sent to another friend and he told me it doesnt work because its buggy but i made a new app and only put this in there with the sprite and the canvas and it still wont move

ANY idea will be greatly appreciated
HERES THE AIA FILE:
ICARUSKOPIJASCORE (2).aia (3.5 MB)

ps this works for my friend when he moves the ball he showed me in school,but the ball movement doesn't work for me tho

Does your Android have an Orientation sensor? Most of the latest Android hardware does not have an Orientation sensor.

See OrientationSensor

Use this Block:

Available to indicate whether the orientation sensor is present on the device.

If Available is false; your device does not have the sensor.

the problem is that the movement he showed me works on my friends phone i sent him my .aia and my app didnt work on his phone

Well, does it Nicola?

Developers often use the Accelerometer to provide similar functions.

it does not, is there a way to do it with accelerometer with my code, imgspriteicarus needs to move on the x axys

Here is a discussion OrientationSensor Pitch movement (or how to use Accelerometer to detect movement) .

I think there is an example (incomplete) using an accelerometer to detect orientation/movement. There is an example of using a gyroscope sensor at the end of the thread. If your device has a gyroscope, you might use that.

If all this fails, you could make a 'joystick' out of buttons to move your Sprite, :cry:

I found this. It might be a solution for you How To Move Any Sprite Using Accelerometer Sensor In Mit App Inventor - YouTube

Try it an let us know if it works. If it does, you might post your code so others can learn. :slight_smile:

2 Likes

How to move your image sprite with Accelerometer sensor,

Simple app, the sprite moves on the x axys.
To move it in all 4 directions add this part
image

AIA FILE:
icarusfalls (1).aia (42.0 KB)

Works thank you so much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.