Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a bullet come out the front of a gun?
- FireFlower46
-
New Scratcher
4 posts
How do I make a bullet come out the front of a gun?
How do I make a bullet sprite clone appear out of the edge/front of the gun and then have it move forwards to the edge of the screen/till it hits something, with the barrel as the start point?
- Tsunami_trouble11
-
Scratcher
80 posts
How do I make a bullet come out the front of a gun?
You could use this script in a sprite for the bullets.
when green flag clicked
forever
if <key [space v] pressed?> then // change this to the key you want to shoot the gun with
create clone of [myself v]
wait (1) secs //change this value to adjust how many seconds the gun takes to fire again
end
end
when I start as a clone
go to [gun v]
point in direction ([direction v] of [gun v]
repeat until << touching [edge v] ? > or < touching [put other sprite here v] ? >>
move (5) steps //change this to the speed you want
end
delete this clone
- 72rabbit23
-
Scratcher
14 posts
How do I make a bullet come out the front of a gun?
make sure to hide the original bullet sprite by using this code:
and show the clone under the point in direction direction of gun block:



when green flag clicked
hide
and show the clone under the point in direction direction of gun block:
when i start as a clone
go to (gun v)
point in direction (direction of (gun v))
show



- FireFlower46
-
New Scratcher
4 posts
How do I make a bullet come out the front of a gun?
i figured it out like an hour ago but scratch decided not to show me these replies until after i figured it out but thanks for the help[
- FireFlower46
-
New Scratcher
4 posts
How do I make a bullet come out the front of a gun?
You could use this script in a sprite for the bullets.when green flag clicked
forever
if <key [space v] pressed?> then // change this to the key you want to shoot the gun with
create clone of [myself v]
wait (1) secs //change this value to adjust how many seconds the gun takes to fire again
end
end
when I start as a clone
go to [gun v]
point in direction ([direction v] of [gun v]
repeat until << touching [edge v] ? > or < touching [put other sprite here v] ? >>
move (5) steps //change this to the speed you want
end
delete this clone
this is the method i ended up using, thanks scratcher
- 72rabbit23
-
Scratcher
14 posts
How do I make a bullet come out the front of a gun?
your welcome always happy to help



- Discussion Forums
- » Help with Scripts
-
» How do I make a bullet come out the front of a gun?