Download

Random coin drop location question

I am creating a tower defense game that is comparable to Plants Vs. Zombies in blueprints. If you are familliar with PvZ, then you know how the sun (money in the game) drops at random locations every few seconds. I have tried spawning my money actors in different locations, but nothing I have tried seems to work. Any ideas how to replicate the Plants Vs. Zombies style drops in my game?

Make a box, and do some vector math to get a random spawn point within the box bounds

How are you trying to do it and in what way does it not work? The spawning doesn’t work, or the location?

There are actually some convenient nodes to do what vanlacke said, Get Component Bounds, and Random Point in Bounding Box.

Just create a blueprint actor that has a volume in it that is the size of your area. Get a random point within the bounds and spawn it there.

for random location you need a box component then you can get a random point inside box with this function like photo 1

then you need to make a function for spawn coins to spawn coins and also call random location function like photo 2

and finally you need a timer to call spawn coins like photo 3