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

#1 2008-06-08 21:05:29

encon101
Scratcher
Registered: 2008-06-08
Posts: 1

can some 1 teach me how to make your sprites shoot

im making a game and im just wondering of some one can tell me how to make sprites shoot please help

Offline

 

#2 2008-06-08 21:13:42

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: can some 1 teach me how to make your sprites shoot

I learned this from I forget who:

[blocks]<when green flag clicked>[blocks]
[blocks]<forever>[/blocks]
[blocks]<if><key[ Space ]pressed?>[/blocks]
[blocks]<point towards( Gun[/blocks]
[blocks]<repeat until><touching[ Edge[/blocks]
[blocks]<move( 10 )steps>[/blocks]
[blocks]<end>[/blocks]
[blocks]<hide>[/blocks]

You can also try  [blocks]<point in direction( <direction of Gun[/blocks]


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#3 2008-06-08 21:32:59

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: can some 1 teach me how to make your sprites shoot

http://scratch.mit.edu/projects/coolstuff/178070

^^^^^^^^^^
check out that project, it has some pretty realistic shooting in it.

Offline

 

#4 2008-06-09 10:39:26

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: can some 1 teach me how to make your sprites shoot

Ok, so you have two sprites.  the shooter and the bullet.

Shooter: this is your tank, airplane, slingshot etc... you may want it to move or rotate.

Bullet: this will appear to shoot from the shooter. 
it will be invisable till it's ready, (hide)
when the trigger button is pressed (space will work) it moves to where the shooter is.
It changes it's rotation to the rotation of the shooter.
use "show" to make it visable.
then it moves forward until it hits something, like the color of an enemy.
also when it hits, it changes it's costume to an explosion then hides again, ready to shoot again. 
That's the gist of how I do it.  http://scratch.mit.edu/projects/AddZero/126604

Bluestribute's code has some of that, and may be a good start.


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#5 2011-06-14 20:58:41

rojasscratches
Scratcher
Registered: 2011-06-01
Posts: 59

Re: can some 1 teach me how to make your sprites shoot

uhh.. bluestribute i tried your suggestion and it doesn't work try this...


For bullet:
When I receive Fire
Go to shooter
Point in direction direction of player 1
Show
Forever
Move 10 steps
If touching edge
hide
stop script

For shooter:
When key space pressed
Broadcast Fire


smile   neutral   sad   big_smile   yikes   wink   hmm   tongue   lol   mad   roll   cool  cool  Scratch Home Page  cool

Offline

 

Board footer