Coin/Item collection?

Hai,

I’ve been working on a 2d game and wanted to know how I would go about implementing a coin/ item collection system. Optimally I would want:

  1. Enemies that drop coins

  2. Capable of being collected by the character

  3. Add to the score

  4. Can be used to buy upgrades and such

I’m totally in the dark right now, so if anyone could give me some script examples of how to implement these, that would be awesome. Thanks.

  1. Simply instantiate the coin prefabs on the death of a monster. You can even set a Random.range to the number of coins a monster drops and then adjust the min/max values with some variables.

If you have no idea what any of that means keep reading.

  1. I won’t write the scripts for you, learning this will make you a stronger designer.

Let me direct you to some tutorials that do almost exactly what you want, give or take, with descriptions of how and why it works and very well commented code.

Please complete these tutorials then return with your questions, by then you should have a general understanding of scripting and the answers you receive will help a lot more!

http://unity3d.com/support/resources/tutorials/penelope

The Penelope tutorial is for the iPhone so you will need to read past the iPhone bits and absorb the information from the scripting lessons.

Thanks a ton, TheLlama. I’ll get working on these right away :).

Your welcome, and hope it helps. I’m always around the boards if you have more questions.