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

#1 2008-03-02 11:31:04

foshizel
Scratcher
Registered: 2008-03-02
Posts: 1

pleas help me im new

how to i make it so when my charechter punches the enemy the enemy dies or just loses health or somthing

Offline

 

#2 2008-03-02 11:47:11

Lanie
Scratcher
Registered: 2008-02-03
Posts: 1000+

Re: pleas help me im new

you want to create a variable called health. when the enemy punches say change health by -1 or whatever number.

<change{  health}by( -10 or whatever number

Offline

 

#3 2008-03-02 16:28:52

Rukqo
Scratcher
Registered: 2008-01-17
Posts: 100+

Re: pleas help me im new

Ok. Here's the script:
Make a costume for your charcter when it's standing and a costume for it when it's puching.

Your hero script:

[blocks]<when green flag clicked>
<forever>
   <if><key[ space ]pressed?>
<switch to costume[ punching costume ]
<wait( 1 ) sec>
<switch to costume[ normal costume ]
    <if><touching[ enemy sprite ]
    <broadcast[ hit ]
<end>
[/blocks]

Make your enemy a costume of normal and being punched
Your enemy script:

Script 1:

[blocks]
<when green flag clicked>
<show>
<switch to costume[ normal enemy costume ]
[/blocks]
Script 2:
[blocks]
<when I receive[ hit ]
<switch to costume[ being punched ]
<wait( 1 )secsc>
<hide>
[/blocks]

Offline

 

Board footer