Friday, April 17, 2015

Updated Trophy Room

I find it amazing how awesome some art work actually helps me write better code. When I got the new art for the trophy room, each trophy was encased in a treasure chest where it would open when its correlated level/challenge was beaten spawning the trophy. The old trophy room was something I had to get up fast for a presentation of the concept, and as such I stuck the spawning code inside the main menu controller that controlled the transition between the main menu and the trophy room. This obviously had to change if I wanted to have n number of treasure chests that could spawn any number of trophies.

This allowed me to generalize the trophy spawn code in a treasure chest class that would be linked to a challenge and would spawn n number of trophies (the Shorca trophy was each of its armor pieces). When a challenge level is beaten and the player goes to the trophy room, the treasure chest will open up and eject the trophy out of it. I probably would have never gotten around to writing better trophy spawner code had it not been for the updated art. Let this be a lesson to artists that the art they give can influence code and if done right, can actually improve code practices.

No comments:

Post a Comment