Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Projectile spawn/destroy

innafinnaf Posts: 5Member, PRO

Hi guys, i have a turret that shoots 10 balls, and after that i want each ball to be destroyed every 1 sec but somehow if i use destroy actor it destroys all the balls in like 2 sec. Anyone have some ideas?


  • tatiangtatiang Posts: 11,906Member, Sous Chef, PRO, Senior Sous-Chef

    Without seeing your rules, it's impossible to know why something isn't working right. Here's what I suggest: in the ball actor, have a Change Attribute behavior to change game.ballCount (integer) to game.ballCount+1. This behavior should NOT be inside of a rule but rather at the top of the rules list. Have a rule that says When attribute game.ballCount>10, and inside of that rule have a Timer that is set to After 1 second with a Destroy Actor behavior inside of the timer.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • innafinnaf Posts: 5Member, PRO here is the rule, the game.Total is the same like the game.ballCount. The problem is that destroy actor actually destroy all the balls at once.
    Basically i want it to destroy the first ball then second and so on

  • bufteabuftea Posts: 43Member

    I have an idea to your question. I hope I understand the question correctly. You could use an invisible actor shaped like a hollow circle around the turret, and set a rule for the ball to be destroyed when colliding with the circle actor

  • innafinnaf Posts: 5Member, PRO

    To explain it more, the turret shoots balls every 0,5sec at player and the balls bounce all over the scene, and i want to have max 10 balls so after 5 sec the first shot ball should be destroyed and new one spawned. But now after 5 sec they are being randomly destroyed

  • jamie_cjamie_c Posts: 5,576Member, BASIC

    If you are spawning the balls add a timer behavior to the prototype actors that says:

    Timer after 5 seconds
    Destroy Behavior

    So each ball fired would destroy itself after 5 seconds on screen, they would destroy themselves in the order they are fired.

  • innafinnaf Posts: 5Member, PRO

    got it now, thank you!

Sign In or Register to comment.