BGP Week 4 – Collectibles

While it did not take up much time, the most noticeable thing I worked with during the fourth week was our collectibles. Specifically, the scripts needed for them to be picked up and for the result to be recorded.

The first part was to create a script that would receive the information. This was made out of two integers representing small and large collectibles, and two functions that when called would increase the designated integer. So it the pickup for a small collectible was called, the integer for small ones would increase with a set amount.

Next was creating the scrips for the collectibles themselves, a rather simple case where I made two very similar scripts for the small and large collectibles. When the collectible detects collision with the player, they call upon their respective functions over in the receiver script, increasing the relevant score, and then destroys itself.

Finally, some time later on, the receiving script was upgraded so that when 10 small collectibles were gathered, the count resets to 0 and one large collectible is gained. Along with this, I also wrote a function that counts the number of large and small collectibles in the map, and from that declare the total amount of large ones the player can collect.

About Stefan Ekdahl

2014  Programming