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

#1 2011-01-21 10:52:43

RedAlertFan
New Scratcher
Registered: 2011-01-21
Posts: 6

Making a Bullet

I want my sprite to spawn a bullet and send it to the direction it's facing. I'm a new user, and need help from the more advanced users.

Offline

 

#2 2011-01-21 17:07:17

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Making a Bullet

The easiest way to do that is to add a script to the character sprite that broadcasts a message (using the "broadcast _ and wait" block) whenever the button to shoot is pressed. Then on the bullet, make a script that looks like this:

Code:

When I receive "shoot"
Show
Point in direction [direction of player]
Repeat until touching [enemy] or touching [edge]
     Move 5 steps
End Repeat
Hide

http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-01-21 17:32:41

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Making a Bullet

Harakou, don't you mean [point towards [enemy]]?  tongue


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#4 2011-01-21 18:01:54

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Making a Bullet

But that would be too easy!  tongue


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer