Have Actor Spawn Every 2 Seconds When Inside

JoshKahaneJoshKahane Member Posts: 470
edited November -1 in Working with GS (Mac)
Hi

I am having troubles creating an actor that spawns every 2 seconds when your touching inside an actor. This is so that performance isn't hit so badly, I don't want the player to be able to rapidly tap the screen and tons spawn, I only want it to be able to spawn every 2 seconds.

Hope you can help, thanks.

Comments

  • rebumprebump Member Posts: 1,058
    A few different ways to handle this. Assuming a "fire" button scenario.

    A timer that runs every two seconds and if the fire button/touch is pressed/present, spawn a new one.

    A boolean attribute that gets set to "true" when an item is spawned. Then a timer is kicked off and after two seconds sets the attribute back to "false" to signify another spawn can be done.

    The spawned actor could also kill itself off after the two seconds if you want to limit the count of the on-screen spawned actor.

    As with most other logic and programming-esque tasks, there is likely a handful of other ways to handle this.

    See if some of the shooter demo implement this...
Sign In or Register to comment.