Android Mobile GyroScope


I’ve been cleaning out old projects and experimental work. This Android Mobile Gyroscope code I was going to build up into a space run style of game inspired by my memories of a favorite Atari Star Wars cabinet.

The player object is the blue cube that flies down the “canyon” and has to dodge the incoming objects. If it gets hit by one it turns red momentarily. There is a “turbo” button for when your confidence gets better at controlling it so you can speed up the interactions.

The code for the controller and the base assets for the project are free in my github repo: https://github.com/zuluonezero/GyroController

The demo was made with Unity. Most of the interesting code for controlling the “player” is in the GyroController.cs. This handles the input from the gyroscope on the mobile device and limits the player movement into quadrants on the screen. It was a deliberate choice to make the player cube jump between locations on the screen rather than interpolate smoothly as this made it easier for player to judge distance within the playing field.

The Controller.cs just handles game play.

The original game is and was amazing for it’s immersion – mine less so. But if you want to know more about the original and it’s legendary creator Mike Jang there is a good article here: https://arcadeblogger.com/2024/02/13/ataris-mike-jang/

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *