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

#1 2009-04-18 10:15:44

Generalflood
Scratcher
Registered: 2009-04-17
Posts: 4

How do I make enemies react to bullets?

Ok, say I want to go about making an enemy die on contact with a bullet, how would I do that?

Also, how would I make an enemy take more than one shot?

Offline

 

#2 2009-04-18 11:01:56

Masterdan
Scratcher
Registered: 2009-03-28
Posts: 58

Re: How do I make enemies react to bullets?

Die when hit by a bullet:

<when green flag clicked>
<forever if><touching[ Bullet
<change{ Dead }by( 1

Multiple hits:

<when green flag clicked>
<forever if><touching[ Bullet
<change{ Dead }by( 1                     

<when green flag clicked>
<forever if><( <{  dead}> <=> 10 )>
<broadcast[ dead

That means if he is hit 10 times he dies. To change this to 5 or something else; change the <(  <{ dead }><=>  ???)>


http://img145.imageshack.us/img145/7089/puzzleadvert.pnghttp://www.neopets.com/refer.phtml?username=dan_84_dan Click there for fun stuff and to get me free stuff!

Offline

 

#3 2009-04-18 12:08:32

bosox397
Scratcher
Registered: 2008-02-17
Posts: 1000+

Re: How do I make enemies react to bullets?

And use this to hide him when he dies:

<hide>


Dear Scratch Users,
I'm done with scratch, or at least making projects. I have made one last big game, thats both fun and teaches a lesson about water. It'd mean a lot if you gave me feedback.                              http://scratch.mit.edu/projects/bosox397/569201

Offline

 

#4 2009-04-18 12:09:51

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: How do I make enemies react to bullets?

<when green flag clicked>
<forever if><touching[bullet
<hide> or "<switch to costume[deads
then <hide>"
<end>


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#5 2009-04-18 14:07:45

pokemon_master12
Scratcher
Registered: 2008-09-26
Posts: 100+

Re: How do I make enemies react to bullets?

You'd have to use broadcasting for that. You can use the broadcast block in the control section that will send a message to the enemy telling it to fall backwards.


My Dragon Egg! http://dragcave.net/image/5YUA.gif
Visit my blog: http://freyasworld.wordpress.com/

Offline

 

Board footer