# Week 6
This week was very satisfying and scratched that itch that developers can only get at by refining their codebase. I worked hard to fix some outstanding bugs and improve the respawn and replay system used for the player’s moth. Tim also modelled and animated our player (the moth) and an enemy (the hand) which really brought the game to life.
# Last Week, Briefly
Although we don’t have a journal entry for last week, we made quite a bit of progress as we needed a playable protyle for playtesting purposes. We implemented our light collection game mechanic which restored the players stamina on collision. Stamina is then tied to the intensity of the light which follows with player around the dark world. With less stamina, the player has less visibility and is unable to avoid the obstacles in their path. We also implemented a basic UI to show this stamina and game completed state once the player had navigated to the end of the level.
# This Week, Refined
While Justin did a great job of implementing up the basic animations state of our moth in Unity, I set off to refine our FlightRecorder
and FlightRecording
classes. These are two classes I created to handle the recording and replay of the moth’s flight path. The FlightRecorder
class contains a list of FlightRecording
's and then uses those to spawn and replay the movements of the players past attempts. One issue with this system was that the flight replays would happen noticly faster than real time, leading to the ghost moths flaying way ahead of the player. This occurres because the flight recording data was people played though as fast as possibly, one frame after another without any regard for when each from of movement was recorded. To solve this, I added a timestamp property to the FlightRecording
class so that every position capture by the FlightRecorder
would come with the time that it was recorded. With this information, I then only increment the flight playback if the “playhead” is further along than when that frame of flight data was captured. This prevents the moth from moving any faster than real time but doesn’t prevent it from lagging behind. In future revisions I will deal with latter issue but for now our bug is solved and the ghost moths replay the user’s motion is real time. It’s almost like magic!