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

#1 2012-10-17 13:48:24

ZerozoGames
New Scratcher
Registered: 2012-10-10
Posts: 4

How do I make a gun script?

What I want to happen is when the "S" key is pressed for a bullet to shoot out of the sprite I'm playing with. How do I do this?
~Zerozo

Offline

 

#2 2012-10-17 13:51:33

ZerozoGames
New Scratcher
Registered: 2012-10-10
Posts: 4

Re: How do I make a gun script?

Oh and I need the bullet to shoot in the direction of the mouse cursor OR if you can't do that for it to shoot in the direction of whatever arrow is being held down

Offline

 

#3 2012-10-17 14:07:57

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: How do I make a gun script?

Make a bullet sprite and a sprite for the person shooting.
The person shooting can have any movement scripts you want.

For the bullet:

when gf clicked
hide
forever
if <key [s v] pressed?>
go to [person v]
point towards [mouse-pointer v] // makes it point towards mouse cursor
show
repeat until <<touching [edge v]?> or <touching [anything else v]?>>
move (10) steps
end
hide
end
Hope this helps, and good luck with your project!


http://i48.tinypic.com/2072ctw.gif

Offline

 

Board footer