Today had me studying less design patterns than I thought, but that was no worry since I was a bit busier today and needed to level out my extracurricular studies. I found a great example of a repeated terrain use of the Flyweight pattern and went over the Proxy, Chain of Responsibility, and Interpreter patterns.
As for more flash work, I managed to create a helpful (and not global!) sound manager class, along with an extended subclass of Sound that I created to load itself, create only when called, and not have any unnecessary access while it was loading. This also required the subclass to contain its channel, which worked nicely. I also found out that traditionally, Flash plays mp3 files but not wav files. I will have to keep my eye on that.
Hm, as for something visual? I added a quick and neat portion to the enemy's movement where they would take the direction of the player and move toward it. This was a simple distance calculation and moving the x and y by the direction vector (playerPosition - enemyPosition) and dividing it by magnitude; this can also be manipulated by speed to give an extra hunting movement to the lizards as they fall down, fairly increasing the difficulty for less enemies on the screen (cheaper for the rest of the program!) :
What onto next? Welp, there's still three more tutorial portions to go before I can be sure I'm ready to tackle Flash, but these classes I'm making will help immensely when the time comes to crank out some prototypes.
No comments:
Post a Comment