This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-03-03 00:04:26

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Help please

<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

 

#2 2008-03-03 00:36:26

Rukqo
Scratcher
Registered: 2008-01-17
Posts: 100+

Re: Help please

Huh?

Offline

 

#3 2008-03-03 09:41:13

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Help please

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

 

#4 2008-03-03 10:45:04

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Re: Help please

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

 

#5 2008-03-03 12:04:22

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: Help please

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

 

#6 2008-03-03 16:21:19

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Re: Help please

I finally got my WeaponActive to appear! YAY!

Now, my "bullets" shoot three at a time if you press the space bar to hard. Is there a way to adjust the sensitivity? Thanks!

Offline

 

#7 2008-03-03 16:23:43

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Re: Help please

Also, one of my bullets keeps going off to the side instead of increasing ten on the y axis like I asked it to. How do I fix this? Thanks again!

Offline

 

#8 2008-03-03 18:46:44

Rukqo
Scratcher
Registered: 2008-01-17
Posts: 100+

Re: Help please

Yes. To adjust sensivity, add a "wait 0.1 secs" before you continue.

Offline

 

#9 2008-03-04 00:01:40

mankee34
Scratcher
Registered: 2008-02-27
Posts: 19

Re: Help please

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

 

Board footer