Projectile spawn/destroy

innafinnaf Member, PRO Posts: 5

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?

Comments

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

    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 Member, PRO Posts: 5

    http://i.imgur.com/jCXsM85.png?1 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 Member Posts: 43

    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 Member, PRO Posts: 5

    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 ImagineLabs.rocks Member, PRO Posts: 5,772

    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 Member, PRO Posts: 5

    got it now, thank you!

Sign In or Register to comment.