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

#1 2009-10-11 19:58:12

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

How to spawn (projectiles)?

I'm on SFT and I need to know how to spawn projectiles, such as lasers. Spawn as in "place the laser sprite in front of the ship, let it move forward, and animate hit on meteor." Please help.


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#2 2009-10-11 20:01:38

steppenwulf
Scratcher
Registered: 2009-07-23
Posts: 1000+

Re: How to spawn (projectiles)?

Could you be more specific? Are you asking how to shoot?


I'm graduating HS this April and going to college in the Fall.

Offline

 

#3 2009-10-11 21:04:57

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How to spawn (projectiles)?

Let the laser sprite go to the ship when whatever key pressed. Then let it move 10 steps until it hits the edge or the meteor. On the meteor, make it so that when the laser sprite touches it, it animates. For that, you will have to make different costumes of a meteor exploding and play it when the laser hits.


Hai.

Offline

 

#4 2009-10-11 23:41:56

martianshark
Scratcher
Registered: 2008-03-24
Posts: 1000+

Re: How to spawn (projectiles)?

Do something like this:

Ship's script
<when green flag clicked>
<forever>
<if> <key[ space  ]pressed?>
<broadcast[ shoot  ]and wait c>
<end>
<end>

Laser's scripts:

<when green flag clicked>
<hide>

<when I receive[ shoot
<go to[ ship
<point in direction( <direction of [ ship ]>
<move( 10  )steps>
<show>
<repeat until> <touching[ edge
<move( 10  )steps>
<end>
<hide>


http://img.geocaching.com/stats/img.aspx?txt=martianshark&amp;uid=e6cdc2c8-2476-4abd-9994-27f857396579&amp;bg=1

Offline

 

#5 2009-10-12 00:49:13

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How to spawn (projectiles)?

Using MartianShark's method:
Bullet:
http://img86.imageshack.us/img86/9861/78135750.gif

Ship:
http://img517.imageshack.us/img517/3310/56803516.gif


Hai.

Offline

 

#6 2009-10-13 06:06:52

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: How to spawn (projectiles)?

Ok, should there be a variable to tell when the meteor hits it to "turn it off" so I can't hit it until I restart the game?

steppenwulf wrote:

Could you be more specific? Are you asking how to shoot?

Yeah, that's what I'm trying--in a space field. I was being specific; I just didn't tell it in plain English. I guess you could have used something called context clues. http://www.icompositions.com/forums/images/smiles/biggrin.png

Last edited by Vista4563 (2009-10-13 06:08:39)


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#7 2009-10-14 16:34:49

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: How to spawn (projectiles)?

Please help, I'm trying to help him ASAP through the SFT.


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#8 2009-10-14 18:21:55

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How to spawn (projectiles)?

restart the game? WDYM?


Hai.

Offline

 

#9 2009-10-14 18:48:57

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: How to spawn (projectiles)?

I mean using the start and stop buttons. Or if my restart button is clicked in the scratch window.


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#10 2009-10-14 19:09:18

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How to spawn (projectiles)?

So it can only fire once in the whole game? If it is, just add a stop script after it fires.


Hai.

Offline

 

#11 2009-10-14 19:28:55

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: How to spawn (projectiles)?

no, actually the laser can fire multiple times, its the meteors you can only hit once per game.


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#12 2009-10-14 19:32:54

Ssbrawl700
Scratcher
Registered: 2009-02-11
Posts: 100+

Re: How to spawn (projectiles)?

http://scratch.mit.edu/projects/Ssbrawl700/699305

This project is for shooting projectiles.
As for meteors exploding you have to tell it to wait until touching a bullet and then make it change to an exploding costume and then hide


Can you beat the ever-so challenging Keyboard Khaos?

Offline

 

#13 2009-10-14 20:12:48

Vista4563
Scratcher
Registered: 2009-07-20
Posts: 500+

Re: How to spawn (projectiles)?

Thanks ssbrawl, great (rushed) project!


Team Vista | TBG Moderator | #stopKony #Kony2012 | http://ls.gd/icgrin http://is.gd/78GWUZ
http://is.gd/jEY5Ihttp://is.gd/Vl19zR http://i.imgur.com/L4HIs.png

Offline

 

#14 2009-10-14 22:35:57

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How to spawn (projectiles)?

Correct!


Hai.

Offline

 

Board footer