Make actor create bullets in bursts.

kitanga

  • Posts: 13
I am having some trouble. failing to make my spaceship(actor) shoot 4 bullet bursts please help.
Nday,Kitanga

letmethink

  • *
  • Posts: 2545
What code do you have already?
~Letmethink

Wowlex

  • Posts: 26
do you want all the bullets to shoot out at the same time, like a spread shot shotgun, or like 4 really rapid ones, then a pause? Also is it autofire or do you have to press the button each time?

kitanga

  • Posts: 13
4 really rapid ones. not the shot gun style burst.
Nday,Kitanga

kitanga

  • Posts: 13
This is the code i'm using to make the bullets.
Nday,Kitanga

kitanga

  • Posts: 13
This code isnt working
Nday,Kitanga

ETHproductions

  • *
  • Posts: 430
'Do every 0 seconds' basically means 'do every frame from now until the scene switches or the game ends'. Have you tried deleting that block, and running the rest of the code without it?
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

kitanga

  • Posts: 13
I actually noticed that a few minutes ago, so i deleted the whole thing and started afresh. I'll show you what i have in a few minutes.
Nday,Kitanga

kitanga

  • Posts: 13
Ok this works. but bullets dont stop firing
Nday,Kitanga

ETHproductions

  • *
  • Posts: 430
The problem I see is that the code is not programmed to stop after 4 shots. I'd try using this code instead:
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

kitanga

  • Posts: 13
Thank you that works. But if a player fires twice as fast it shots 8 as fast.
Nday,Kitanga

Innes

  • *
  • Posts: 1960
Just to clarify for kitanga, a [do every] block continues doing its contents forever, regardless of whether or not it is wrapped in a Boolean test. The last code you posted creates a new [do every] block every time you press Action1 and can_shot is true. Even when can_shot is subsequently changed to false, the [do every] block will carry on doing its job until it's cancelled, or the scene ends!
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

Innes

  • *
  • Posts: 1960
Thank you that works. But if a player fires twice as fast it shots 8 as fast.

Can you specify exactly the behaviour you need; for example, how often can the player fire, do you want them to press fire, which gives a burst of 4 shots, then they can't fire for 2 seconds?
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

kitanga

  • Posts: 13
I want the player to hold the fire button and the actor to fire 4 burst shots(with the 0.7sec pause). And so long as the player is holding the fire button, the actor should continuosly fire 4 bullet bursts.
Nday,Kitanga

ETHproductions

  • *
  • Posts: 430
Here's a revised version that matches your description. You can change any of the numbers, as needed.
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.