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

#1 2008-09-27 16:22:24

RukiaKuchiki
Scratcher
Registered: 2008-09-14
Posts: 78

hav a q.....

c, im making a fighting game and im almost finished!! i just need to kno.....i cant explain, so heres an example.

what if im a flower, and im fighting a ball. When i attck the ball, the health goes down to 0. how do i make it stop at 0, and say that the flower wins?? or vise versa(like if the flowers heatlth goes down to 0, and that the flower loses?).  I hope u understand what im trying to say! Thanks!!

- Rukia Kuchiki

<forever>


http://i292.photobucket.com/albums/mm27/MoonPrincessMewMew/Sailor%20Moon/thmoon_spiral_heart_attack1.gifhttp://i110.photobucket.com/albums/n88/beewee3/inuyasha/thKikyo-1.gif http://i280.photobucket.com/albums/kk181/Tohru_Honda_Yuki_Sohma/0989f47ecabe30_full.jpghttp://i701.photobucket.com/albums/ww19/Monkeex3/fruits_basket_354.jpg

Offline

 

#2 2008-09-27 16:27:08

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: hav a q.....

Try something like this

when flag clicked
wait until flowerHP<1
broadcast ballWins

when flag clicked
wait until ballHP<1
broadcast flowerWins

Something like that.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#3 2008-09-27 16:28:42

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: hav a q.....

<forever>
     <if><( <{ P1 Life }> <>> 0 )>

           Put scripts for p1.

     <end>
          <if><( <{ P1 Life }> <=> 0 )>
          <broadcast[ P2 win ]
     <end>
<end>

Last edited by keroro645 (2008-09-27 16:29:25)

Offline

 

#4 2008-09-27 16:32:21

RukiaKuchiki
Scratcher
Registered: 2008-09-14
Posts: 78

Re: hav a q.....

archmage wrote:

Try something like this

when flag clicked
wait until flowerHP<1
broadcast ballWins

when flag clicked
wait until ballHP<1
broadcast flowerWins

Something like that.

can u show me in the block form plz?


http://i292.photobucket.com/albums/mm27/MoonPrincessMewMew/Sailor%20Moon/thmoon_spiral_heart_attack1.gifhttp://i110.photobucket.com/albums/n88/beewee3/inuyasha/thKikyo-1.gif http://i280.photobucket.com/albums/kk181/Tohru_Honda_Yuki_Sohma/0989f47ecabe30_full.jpghttp://i701.photobucket.com/albums/ww19/Monkeex3/fruits_basket_354.jpg

Offline

 

#5 2008-09-27 16:33:30

RukiaKuchiki
Scratcher
Registered: 2008-09-14
Posts: 78

Re: hav a q.....

keroro645 wrote:

<forever>
     <if><( <{ P1 Life }> <>> 0 )>

           Put scripts for p1.

     <end>
          <if><( <{ P1 Life }> <=> 0 )>
          <broadcast[ P2 win ]
     <end>
<end>

ok......u put it to where i could understand it, but now im confused.


http://i292.photobucket.com/albums/mm27/MoonPrincessMewMew/Sailor%20Moon/thmoon_spiral_heart_attack1.gifhttp://i110.photobucket.com/albums/n88/beewee3/inuyasha/thKikyo-1.gif http://i280.photobucket.com/albums/kk181/Tohru_Honda_Yuki_Sohma/0989f47ecabe30_full.jpghttp://i701.photobucket.com/albums/ww19/Monkeex3/fruits_basket_354.jpg

Offline

 

#6 2008-09-27 16:40:31

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: hav a q.....

Ok I am going to try to explain it more clearly.

Both your sprites need to have some sort of variable for the sprites health.
To make the ball win the flower's health must be less than 1 and to make the flower win the ball's health must be less than 1. So what you do is you make a script that waits until one of the sprites' health variables is less than 1 then declare the winner.


Like this for the flower.

<when green flag clicked>
<wait until>  <( <{BallHealth  }>  <<> 1 )>
<broadcast[ TheFlowerWins]

Last edited by archmage (2008-09-27 16:41:20)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#7 2008-09-27 17:07:34

RukiaKuchiki
Scratcher
Registered: 2008-09-14
Posts: 78

Re: hav a q.....

im sry. but i still dont understand......u must think im so stupid......i tried doing that. but it didnt work. What if i told u, i had 5 sprites to choose from, and 1 sprite moved byitself and fought the other 5? Does that make a difference?


http://i292.photobucket.com/albums/mm27/MoonPrincessMewMew/Sailor%20Moon/thmoon_spiral_heart_attack1.gifhttp://i110.photobucket.com/albums/n88/beewee3/inuyasha/thKikyo-1.gif http://i280.photobucket.com/albums/kk181/Tohru_Honda_Yuki_Sohma/0989f47ecabe30_full.jpghttp://i701.photobucket.com/albums/ww19/Monkeex3/fruits_basket_354.jpg

Offline

 

#8 2008-09-27 17:09:28

RukiaKuchiki
Scratcher
Registered: 2008-09-14
Posts: 78

Re: hav a q.....

archmage wrote:

Ok I am going to try to explain it more clearly.

Both your sprites need to have some sort of variable for the sprites health.
To make the ball win the flower's health must be less than 1 and to make the flower win the ball's health must be less than 1. So what you do is you make a script that waits until one of the sprites' health variables is less than 1 then declare the winner.


Like this for the flower.

<when green flag clicked>
<wait until>  <( <{BallHealth  }>  <<> 1 )>
<broadcast[ TheFlowerWins]

im sry. but i still dont understand......u must think im so stupid......i tried doing that. but it didnt work. What if i told u, i had 5 sprites to choose from, and 1 sprite moved byitself and fought the other 5? Does that make a difference?


http://i292.photobucket.com/albums/mm27/MoonPrincessMewMew/Sailor%20Moon/thmoon_spiral_heart_attack1.gifhttp://i110.photobucket.com/albums/n88/beewee3/inuyasha/thKikyo-1.gif http://i280.photobucket.com/albums/kk181/Tohru_Honda_Yuki_Sohma/0989f47ecabe30_full.jpghttp://i701.photobucket.com/albums/ww19/Monkeex3/fruits_basket_354.jpg

Offline

 

#9 2008-09-27 18:25:13

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: hav a q.....

Post the project and I can give you the exact code you need. But really all you have to do is check if the health variable is less than 1.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#10 2008-09-27 18:50:45

RukiaKuchiki
Scratcher
Registered: 2008-09-14
Posts: 78

Re: hav a q.....

archmage wrote:

Post the project and I can give you the exact code you need. But really all you have to do is check if the health variable is less than 1.

ill post the project, but then ill update it, after u tell me. its a sailor moon fighting game.....ill post it now..


http://i292.photobucket.com/albums/mm27/MoonPrincessMewMew/Sailor%20Moon/thmoon_spiral_heart_attack1.gifhttp://i110.photobucket.com/albums/n88/beewee3/inuyasha/thKikyo-1.gif http://i280.photobucket.com/albums/kk181/Tohru_Honda_Yuki_Sohma/0989f47ecabe30_full.jpghttp://i701.photobucket.com/albums/ww19/Monkeex3/fruits_basket_354.jpg

Offline

 

Board footer