accelerometer ?
http_gamesalad
Member Posts: 1,340
Anybody know a good working x axes (right & left) accelerometer tilt?
I'm really bad at this.. for some reason I can't make it realistic
Comments
Google is your friend.
http://lmgtfy.com/?q=gamesalad+accelerometer+tutorial
That said, I have never once encountered a game with accelerometer controls that I didn't hate.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Hi @http_gamesalad, I have an Accelerometer Tutorial you might find useful. There are several methods of setting up controls, but the one below worked well for the game I was developing at the time.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@jamie_c thanks
You're welcome, hope it helps.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@jamie_c hey I tried out your video & its working, kinda sorta.. when I tilt right it works but when I tilt left nothing happens... I double checked everything... Are you sure its accelerometer.x > -0.005? & not (<) instead? Thanks
I haven't watched that video but the general idea is that accelerometer values are neutral at 0 and then small tilt motions cause the attributes to become either positive or negative depending on the direction. So you'd either be checking for > [small positive number] or < [small negative number]. If you instead do >0 and <0, you end up with no way to stop the motion (it's basically impossible to get 0 by holding the device really still, but it's not so difficult to get something like 0.1 or -0.1). The use of X, Y, or Z depends on the physical orientation of the device. I usually place a Display Text behavior in an actor to show all three values and use roundTo(attribute,numberOfDecimalPlaces) to shorten the displayed value. Then when I move the mobile device, I can see the values and how they change.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@http_gamesalad, yeah I'm sure that is how it was set up and working. See @tatiang explanation of why above. If it's helpful to you I have the source files available for free for all my tutorials at my website (linked in my signature below). Feel free to download the file and rip it apart to see just how it works, I'm sure you'd find any errors in your behaviors that way.
The demo file does exactly what is mentioned above, there are two text display actors on screen so you can see exactly what numbers are registering on the device, you can see them in the video when I demo it on an actual iPad.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Test it out and mess around with the values a little bit. If i remember correctly, this template needed a little tweaking last time i messed with it.
Fortuna Infortuna Forti Una