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

#1 2009-09-10 23:21:16

Brass45
Scratcher
Registered: 2009-05-03
Posts: 500+

AI Machine guns?!

Hello,Brass45 here,and I need help making an AI machine gun for scratch(I'm making a terminator-spoof type game).I know to use multiple sprites and a variable to control when they fire,and it works just fine with a "mouse down" command,but as soon as soon as I use a "When I Recieve"command,the variable changes,but only one bullet comes out!Please help Immediatly!Here are the scripts I used.Thanks.
<when green flag clicked>
<forever>
<wait(1 )secsc>
<if><( <pick random( 1 )to(10)  <=>10  )>
<repeat( 12)>
<broadcast[ fire]>
<wait( 0.1 )secsc>

<when I receive[ fire]>
<if><( <{ shoot }> <=>so-so )>
<wait(  0.1)secsc>
<set{shoot  }to( so-so)>
<go to[ gun]>
<point in direction(direction of gun) >
<repeat until><touching[ edge]>
<move( 10 )steps>
Note:I mean a 2-D fighting game,not a first-person shooter.

Last edited by Brass45 (2009-09-11 07:59:29)


http://img412.imageshack.us/img412/4593/ubd1591.png<--Our website(click)
http://static.zooomr.com/images/8884671_b196719ffa_o.png<--If this image looks interesting,then click it to see an exclusive sneak peak of Evil Strings newest game:DarkLight

Offline

 

#2 2009-09-11 00:48:18

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: AI Machine guns?!

All I can suggest is looking through M44's stuff... here's the link: M44's stuff


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#3 2009-09-11 03:50:41

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: AI Machine guns?!

Try using Broadcast And Wait instead of Broadcast.  Broadcast And Wait will wait until the scripts that are triggered by it are complete before moving on to the next block.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2009-09-11 07:55:57

Brass45
Scratcher
Registered: 2009-05-03
Posts: 500+

Re: AI Machine guns?!

That works okay,but the gun would be Semi-Automatic because you would need to wait until the bullet hit the edge for the next one to fire.I could make it work,though.

Last edited by Brass45 (2009-09-11 09:19:13)


http://img412.imageshack.us/img412/4593/ubd1591.png<--Our website(click)
http://static.zooomr.com/images/8884671_b196719ffa_o.png<--If this image looks interesting,then click it to see an exclusive sneak peak of Evil Strings newest game:DarkLight

Offline

 

Board footer