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

#1 2011-11-18 15:39:57

Hellchild96
New Scratcher
Registered: 2011-11-18
Posts: 5

I need to make a shooter

I'm trying to make a game that require's you to stop balls from hitting a central block, and i need to know how to make a sprite shoot another sprite, e.g. a gun is one sprite and the bulet is another. Any ideas on how to do this?

Offline

 

#2 2011-11-18 16:02:38

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: I need to make a shooter

you need lots of bullet sprites and a variable called bullets. Then make a script like this:
<when[ fire ]key pressed>
<if><( total number of buller sprites <>><{ bullets }>  )>
<change{ bullets }by( 1
<broadcast[ fire ]and wait c>
<end>

in each of the bullet sprites, it will have a personal variable called bullet id

<when I receive[ fire
<if><( <{ bullets }> <=> <{ bullet id }> )>
<go to x sad  (x position) of (gun) )y sad  (y position) of (gun)
<show>
<wait until><touching[ a srite which stops bullets
<hide>
<broadcast[ hit wall ]and wait c>
<end>
Also, this belongs in all about scratch.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#3 2011-11-18 16:39:56

Hellchild96
New Scratcher
Registered: 2011-11-18
Posts: 5

Re: I need to make a shooter

Thats helpful, but not quite what im after, I should have been clearer. The gun needs to fire automaticly, The placer defends against them. Also, the gun is moving fast, so i cant use the [blocks]<go to x sad   )y sad  [/blocks].

Offline

 

Board footer