Day 12: Device Controls


Development time: 1 hour

Today the device controls needed to be fixed.  I had previously used the gyroscope for control in the GameDev Journey game I made for MeatlyJam, but I wasn't happy with the gyroscope drift.  The controls didn't feel right.

I opened a few of the default Corona sample projects until I found Shape Tumbler and saw that accelerometer events should do the trick.  I added the accelerometer code and tested it on device, and I discovered that the accelerometer Y axis was the only one I should need for back and forth ship movement.  I also found that the ship was moving too quickly on device when compared to the precision of the keyboard, so I added a check that slows ship movement when the game is running on device.  I also added a transparent rectangle over the entire screen that will capture touch events and cause the ship to fire.  

Now the device controls are fairly easy: tile left and right to move, tap to fire.

Next: Day 13

Get Asteroid Blasteroid

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.