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

#1 2012-09-13 06:43:02

alighope123456
New Scratcher
Registered: 2012-09-13
Posts: 5

Help with project

I'm in the middle of making a game for my gcse coursework and I have a time variable.

I want to time variable to completely stop when the monster's health reaches 0.

Which bits of script do I need to perform this? Please help  big_smile

Offline

 

#2 2012-09-13 06:47:40

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Help with project

I have to get off right now, so sorry for the brief answer:

if <(monster hp.) > (0)>
 change [timer v] by (1)
 wait (1) secs
end
I hope that this helps!

Last edited by ErnieParke (2012-09-13 06:48:48)


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2012-09-13 06:53:34

alighope123456
New Scratcher
Registered: 2012-09-13
Posts: 5

Re: Help with project

Thank you for your help, but it didn't work!  sad  anymore ideas??  big_smile

Offline

 

#4 2012-09-13 07:04:11

alighope123456
New Scratcher
Registered: 2012-09-13
Posts: 5

Re: Help with project

[scratchblocks]
when gf clicked
if <(swamp monster's health) > 0 >
  change [time] by 1
  wait 1 secs
end

Offline

 

#5 2012-09-13 07:04:45

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Help with project

alighope123456 wrote:

Thank you for your help, but it didn't work!  sad  anymore ideas??  big_smile

Could you say how it didin't work?

Ex. It doesn't stop when the monster's hp is less then 0, ect...


http://i46.tinypic.com/35ismmc.png

Offline

 

#6 2012-09-13 07:06:00

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Help with project

alighope123456 wrote:

when gf clicked
forever
if <(swamp monster's health) > (0) >
  change [time v] by (1)
  wait (1) secs
end

Fixed and added a forever block.

Last edited by ErnieParke (2012-09-13 07:06:56)


http://i46.tinypic.com/35ismmc.png

Offline

 

#7 2012-09-13 07:07:24

alighope123456
New Scratcher
Registered: 2012-09-13
Posts: 5

Re: Help with project

When the monsters hp reaches 0 the time is meant to stop but it doesn't, it just keeps counting down to 0 then says game over.

I need the time variable to hide and completely stop when monsters hp is 0

Offline

 

#8 2012-09-13 07:11:36

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Help with project

when gf clicked
show variable [time v]
set [time v] to [0]
repeat until <(HP left) < (0.1)>
wait (0.98) secs
change [time v] by (1)
end
hide variable [time v]
stop script

Last edited by jontmy00 (2012-09-13 07:11:58)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#9 2012-09-13 07:18:15

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Help with project

If you mean the time variable under "sensing", you can't stop that.  The only control you have over it is resetting it.  But you can store the time in a different variable.

when gf clicked
set [health v] to (10)
reset timer
repeat until <not <(health) > (0)>>
set [time_it_took v] to (timer)
end


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#10 2012-09-14 08:10:20

alighope123456
New Scratcher
Registered: 2012-09-13
Posts: 5

Re: Help with project

Thank you all very much for your help!!!! Its worked!!! THANK YOU!  big_smile   big_smile

Offline

 

Board footer