<when I receive[ I have an sprite that "Shoots" another sprite. I want the sprite that is doing the to be able to shoot more than one of the other sprites at the same time. The problem is that i set it to where if you press the space bar it broadcasts a signal that responds to all of my "Bullets."
This is what I have for the sprite doing the
<when green flag clicked>
<forever>
<if><key[ space ]pressed?>
<broadcast [Send bullet] >
<end>
For ALL of my "bullets" this is what I have:
<when I receive[Send bullet]
Go to sprite 1
go to front
Repeat until <color is touched>
Change y by 10
Wait 0.025 sec
Is there a way to send more than one "bullet" off at a time with out it zapping back to the start off point?
Last edited by mankee34 (2008-03-03 00:05:15)
Offline
I use multiple bullets in "GravArena": http://scratch.mit.edu/projects/EdnaC/110327 If you look at the "Ship" and the "ShipWeapon" sprites, you'll see how it's done.
There are a lot of projects that do this, and there are a couple of ways to accomplish it. GravArena looks at the bullets and doesn't send a given bullet again until it finishes its flight.
-MrEd
Offline
I downloaded GravArena and looked at the blocks. The only problem is that i need to put:
If WeaponActive of ShipWeapon=0
Broadcast shipweapon1
Stop script.
On my drop down list, WeaponActive isn't there. I have made it a variable on all of my weapons though. Am I doing something wrong?
Offline
When you make the variable, select "for this sprite only". That way each weapon sprite will have its own variable, and the sensing block will be able to "read" it. See the thread on "help with variables" for more discussion of local variables (for this sprite only) vs global variables (for all sprites).
As you are probably aware, the actual name that you choose for the variable isn't important, you could shorten it to "active", or use some other name. I'm a good typist, so I sometimes get "long-winded" with names.
-MrEd
Last edited by EdnaC (2008-03-03 12:07:36)
Offline
Thank you that worked beautifully!
Now I am having trouble with when I shoot the multiple bullets, a stray bullet begins to move on the x axis, just moving to the right of the screen. Is there a reason for why it is doing this?
Offline