2015年9月26日星期六

The experience of Interactive Prototype 1

This my own experience of the Interactive Prototype 1 that I want to share with you all.

1. Structure the code.
Before actually writing the code, we did an in-class exercise to think about the Classes, their Attributes (Variables) and Abilities (Functions) of our games or wearables, which was a key step to have a clearer idea of how to implement our concepts. Also, I found the learning materials, such as the pong game, are quite helpful for us to quickly familiar with AS3. I highly recommend you to study the code of the examples and figure out why the author structure the code like this.

2. Debug
The Photoshop Flash is not a good development environment as debugging is too hard and there are no detailed logs for the error. The most effective way I learned is to use trace statement to check if the code is executed to a specific line.

3. Fixing bugs
I implemented the majority of the functions but couldn't fix a bug of 'random shooting' feature. Everything seemed alright according to the code's logic. I spent a whole evening to discover why it didn't work and found the problem was caused by the 'Timer Event', but I still had no idea of how to fix it. The bug was solved by Peter eventually, he got rid of one 'Timer Event' (there were two initially) and it worked.

Besides, although I referred an example, it still took me about two days to add the 'restart' function for another game. As AS3 is just like many other programming languages such as C/C++ that have the main function, the sub-functions could not call the main function to loop the game, I had to write another two functions calling each other, using the main function as an entry. Once the game started, it'll execute the main function, then loop between the two functions and never break.

没有评论:

发表评论