The project moves onward toward alpha
|
So, lately I have been working on the powerup code. It’s been quite interesting and has given me some insight in the workings of the code written by our more dedicated programmer, mostly because I copied his code to make it work in our game. First I wrote a simple powerup class under the interactive object class(the interactive object class is basically everything that the player can interact with) holding the functions the different powerups might have in common, after that the classes for the two currently planned powerups, HappyPill, it helps you play longer as it decreases the pumpmeter(your health you can say) which is not allowed to hit full or become empty and decreases over time and increases when you hit things(and people) and BlueCow which increases your movement speed. For now the number of powerups held by the player is a number(two actually, one for each powerup) stored in the player class. The usage of the powerups is handled by the engine right along with movement and is basically checking if the player has any of said powerup and if so apply the effect and then decrease the number of relevant powerup the player has. The impressive powerup class and the implementation of the powerups effect in the code. Not the most elegant of solutions and probably in need of some changing, especially BlueCow, the effect of which is not supposed to be permanent(need to figure that out). The reason I wrote it this way was because it was simpler and it needed to work more than it needed to be good, also using the code of my team-mate as a base meant that compatibility would be easier and there would be less of a hassle with making the code work together(he wrote most of the code so it’s better my code fits his than his code fitting mine). Also writing something that works helps me improve my understanding which in turn might allow me to write an better version if needed. To improve upon is to be more certain I understand the code to help with integration as well as increasing my knowledge,looking things up for example, although most of my problems with this came from not completely understanding the code that my team-mate had written leading to times when I couldn’t make it work properly. There is also the part where I need to work out how to make an effect only last for a limited time, as it stands the effect of BlueCow is permanent, which is not how it’s supposed to work. |
