Enemies drop coins
Hi, I was thinking about making a currency drop system in my game, like when you kill an enemy and coins or exp drop to the ground, you can walk to it and get it. Some examples I can think would be Metroid and Risk of Rain. So what would be the best way to implement it for game performance? I was thinking about using a script on the enemy, that instantiates Prefabs at random directions on OnDestroy or something like that, or maybe use a particle system? I don't know if it's posible.
Answer by ifurkend · Sep 05, 2017 at 06:40 AM
You can have few 3D mesh coins (just a very flat cylinder with appropriate golden texture) tossed by the particle system upward, add some random 3D rotation over lifetime but bring it down by gravity. The eventual stash of coins on the ground would be a single object (fades in by animating its transform.scale from zero to 1), it can be either 2D sprite or 3D mesh, depending on your graphical direction.
Oh I see, what you mean is ins$$anonymous$$d of having every particle being a Coin GameObject, having the single particle system be the Coin GameObject. That seems like a good option, though that way I can't animate every coin going to the bottom of the screen to show how it's being added individually, or can I?
Just for clarification, my first suggestion is closer to the coin drop in Diablo 2. I just checked Risk of Rain gameplay video, one option is to apply Rigidbody/Rigidbody2D to each coin object. First the coin is given some explosion force, then gravity makes the coin drop to the ground collider, after few seconds, enable is$$anonymous$$inematic (ignores physics and colliders) and directly move the coin's transform.position to the player.
Your answer
![](https://koobas.hobune.stream/wayback/20220612134218im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rocket explosion goes off 'randomly' and not when i want to. 1 Answer
Just Cause 3 Volumetric Explosions 1 Answer
how to activate a particle when bullet hits a collider? 1 Answer
Particle Collision causes Explosion?,Explosion on particle contact? 0 Answers
Need some assistance with spot/point lighting for GPU based particles 0 Answers