Sunday, October 28, 2012

Storyboard API & Accelerometer

I finally worked out the issues I was running into this week when working with the Corona Storyboard API. I was trying to refactor our existing game code to use the Storyboard API that's built into the Corona SDK for handling scene/level management. As it turns out, the main problem I had was that I was not "removing" all the listeners before transitioning to another scene. Before I figured out what the problem was, I was getting a vague error, which did not point directly to the problem, thus making it difficult to determine what was causing the problem (and the error). This brings up another point that I would like to look into: the question of whether there is any debugger functionality either built into Corona or available as a third-party add-on. The ability to step the code through a debugger of some kind would have most like helped me to be able to narrow in on the problem quicker. Nonetheless, the code is now using the Storyboard API without throwing any errors.

Another task I completed this week was to add the Accelerometer functionality into the game. Unfortunately, the accelerometer functionality cannot be tested in the simulator. However, I ran the build of the install package and ran it on my Android phone for on-device testing and it works great. That is, rotating the phone right and left drives the movement of the player plane. One note: at first the plane's movement was quite choppy. I experimented with the "system.setAccelerometerInterval()" function in attempt to resolve this. Changing this setting from 100 measurements per second down to 50 resulted in the movement becoming much smoother and less jumpy.

No comments:

Post a Comment