Download

While Loop Crash

i want to have one more ball than the previous time spawned into the arena after the arena has less than 2 balls, i got the amount of the current actor(which is the balls that i want to spawn), and made a while loop that adds one more ball to the spawn count every time it finishes the spawning loop.

can anyone help me with this? please.

i wanna make a simple arcade game that has balls chasing your ball and you need to make them hit each others to eliminate them, and the player get higher scores when the player can get as much balls in the arena as possible. (each “wave” will have one more ball spawned on the field)

Don’t do something like that on tick, you’ll go mad. Tick is designed for things that happen EVERY FRAME, this is not one of those things.

Try this:

I made a badball blueprint, the only code is:

So, when it finds another badball it destroys it and then destroys itself.

The you make another BP, which is going to make all the balls. It has a collision box so it knows where to put the balls:

just stretch it to a good size in the level:

The code in the spawner looks like this:

So, when the game starts, it sets up a timer to call CheckBalls once per second. CheckBalls counts how many badballs we have, if it’s less than two, we call SpawnBalls:

SpawnBalls just increments the number of balls to make ( that starts at 1 ), and spawns them randomly in the box.

Tell me how you do :slight_smile:

balls.gif

thankyou!! it works! now i am trying to get the balls spawning in all the area in the arena randomly except the surrounding area of the ball, i think i can do it :slight_smile: