Monday, October 15, 2012

This Week's Progress

I started off my project work this week by writing a (rough) version of some pseudocode for the game. It will need some work, but hopefully a starting point for getting the overall plan together for how the app should function. I also put together a mockup of the different screens that will comprise the application and how they will be navigated (i.e., which button on each menu/screen leads to where).

While I was testing out the source code we have decided to use as a starting point (pulled from an online demo/tutorial), I found that the bug seemed to contain several bugs. I spent several hours over the weekend becoming familiar with the code and working on fixes: debugging the issues, researching best lua/corona practices, and implementing & testing fixes. Some notes on the issues I worked on:

One of the bugs, which was keeping the restart from working (and was throwing Runtime errors) is that after a bullet is removed the code still attempts to 1) move it upward, and 2) check whether it is offscreen. The solution I implemented was to first check whether the bullet object in the bullets displayGroup is nil, and only perform the above operations on it if it is not. 

There was another bug where bullets were disappearing before they hit the top of the screen. This had to do with the way the display objects were being removed. I made some slight changes to the way in which display objects were being removed and this bug now seems to be resolved. This same bug was affecting the enemy ships, so I made the same fix to that section of the code.

Another change I made was to comment out the function declarations/prototypes. I read somewhere that lua does not require these to be declared ahead of time (and removing did not cause errors).

Some other minor modifications/fixes I made:
- Made alertView global so it could be removed. This was causing problems because it remained on the screen upon restart and the way it was coded I was not able to remove it in the restart function.
- Changed some function names to simplify them (e.g., changed "removeCredits:tap(e)" to "removeCredits()") based on corona documentation.
- Added a variable to hold bullet speed (10 was hardcoded) and enemySpeed (4 was hardcoded)
- Changed the "alert" function to "gameover" function. I had moved some logic around to make things more straightforward. With these changes, it made more sense to call the function "gameOver".

No comments:

Post a Comment