This week I worked, along with our programmer, on the code to improve upon the existing code that we have written for the game. Our movement was a big problem during our last sprint, and we wanted to fix that in addition to many other problems we had with the code.
| Trello Board screenshot taken after Sprint 5 cards were added, blacked out new cards. |
The first thing I wanted to jump on was creating a lives system for the player. While it did not make it into the final build, it still functioned in tests and added a consequence to dying in the game, rather than giving the player unlimited chances at beating it. This code still needs work, as integrations into the player respawn are being worked on. Currently, it does not work to give the player a game over, however it does count down the lives within the debug log.
| Player Lives |
This code counts down your lives each time you die (hitting an enemy, an obstacle, or falling off the level). Once you hit 0 lives, your character becomes inactive and you can no longer control the player. I will be building off of this code to implement a health system, as well as creating a game over screen with menu buttons to restart the game or exit the game.
I definitely ran into a handful of problems when creating this function. Even though the code looks fairly simple, I had to go into the player death code to modify some broken functions in order to make my code work how I wanted. There was also the issue of prefabs being messed up and needing to work with Matthew, our programmer, to get those resolved.
Torch Code
I also created the torch light system, with a little assistance from Matthew. To create this system, I built off of the existing torch system. The existing system made the torches a collectable item, but did not activate a light. It counted the number of torches collected as well. In order to make it so that the player was holding the torch, I duplicated a torch prefab, which I then childed to the player object and hid in the inspector. The code functions in such a way that when the player touches a torch object, it will unhide the torch object, and the player would then be carrying the light. In the future, I will be adding a timer to the torch so that it is only on for a certain amount of time.
We had lots of problems with the respawning system not working, and were not able to figure out these problems before the playtest happened. However, we were able to fix these problems in the few days after the playtest before the sprint was over and now have a much better working game. In order to fix these, I had to almost start the respawn code over from scratch. Originally, I had added the PlayerLives() function to the respawn code, but this broke the function and it did not work at all after that, even though it was only partially working at that point anyway. I read over the player death script and figured out what made the respawn work for obstacles and falling, but not the enemy, and created a new respawn code. It was fairly simple but working with code that I was unfamiliar with made it more difficult to work with. In the end, I created a respawn function that respawns the player to the most recent checkpoint they passed.
| Player Death/Respawn |
The last thing I created was a collectable item. Very simply, the player collects the item by touching it and the console prints "Item Collected". In the future, this will be added to the players save file and you will be able to view your collected items from the levels.
I ran into a lot of programming issues. As I am not a programmer, I fell back onto my 180 projects a lot to create my functions. A lot of the ideas that we wanted to incorporated into the game I had previously created in 180. I also found that whatever tutorials Matthew and Amir had previously used to create other assets did not do things in the most efficient or user friendly way, so I managed to simplify them and make a system that was much easier to work with in order to implement new systems and mechanics.
For the last sprint, I will be refining these mechanics, as well as adding essential ones (obstacles, for example) to the game. I want to create a timed torch system (a key part of the core mechanic), a health bar, and an official game over screen. I also want to add the UI so the player can see their lives and collectables, as well as add power ups and animate the sprites.
No comments:
Post a Comment