How do I have a particle spray trigger once per sprite?

1 favourites
  • 5 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • While the question seems pretty easy to answer with a "trigger once while true" block, for some reason it is not working for me.

    For context, I have two sprites labeled "BombardierBeetle_Sprayer" and I have it so that they SHOULD spawn one spray cone particle. For some reason, however, one of them seems to work and spawn only one of the spray particle instances, but the other is spawning thirteen of them!

    Here is the code that I have

    Here is what happens when I run the code

    As you can see, the top beetle is spawning A LOT of particle sprayers (which lags out my game quite a bit) and the lower one seems to be fine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The design itself logically looks odd.

    Listen to how it sounds.

    You check the animation frame of one bombardier 60 times per second and if it is three then all bombardiers spawn an object.

    You have a dependency on the animation speed and the number of frames. Yes and when there are many bombardiers the check will go to the first one. Sounds creepy.

    Why don't you tell me what you want and I'll create a more optimal algorithm?

  • The design itself logically looks odd.

    Listen to how it sounds.

    You check the animation frame of one bombardier 60 times per second and if it is three then all bombardiers spawn an object.

    You have a dependency on the animation speed and the number of frames. Yes and when there are many bombardiers the check will go to the first one. Sounds creepy.

    Why don't you tell me what you want and I'll create a more optimal algorithm?

    The reason that it fires on the third frame of the animation is because the beetles have a bit of a "wind up" before spraying.

    I want to have it so that, after the beetle's "wind up', they start spraying by having one instance of the spray on each beetle.

    The function of the beetles is supposed to be reminiscent of the "gaster blasters" in Undertale. The spray, unlike the gaster blasters, can move a bit up and down and it is cone shaped instead of a straight line.

    Also I am confused, what are you referring to as "creepy", the fact the sprays all go to one beetle, the concept of the beetles themselves, or something else?

  • I tried to make an example according to your description.

    It is simple and has only two buttons, one to add Bugs and the second to enable and disable the attack.

    All events are based on triggers, which optimizes resources.

    I hope this example will help you to find a solution.

    https://kibaga.org/c3-example/file_uploads/index.php?file_name=../Bugs-Attack-OnOff-Sample.c3p

  • I tried to make an example according to your description.

    It is simple and has only two buttons, one to add Bugs and the second to enable and disable the attack.

    All events are based on triggers, which optimizes resources.

    I hope this example will help you to find a solution.

    https://kibaga.org/c3-example/file_uploads/index.php?file_name=../Bugs-Attack-OnOff-Sample.c3p

    It works great now, thank you! I really appreciate the amount of time you put in to not just explain it, but also create some coding showing the idea! Have a great day!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)