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

#1 2007-06-06 03:16:58

donkeyscommand
Scratcher
Registered: 2007-06-03
Posts: 10

Time limit!

I've made this game called Steady Hand and I have put it on the website but I want to make a better version including a time limit. How do I put it so that it has to touch a sprite in a certain amount of time?

Offline

 

#2 2007-06-06 08:14:46

Duncan
Scratcher
Registered: 2007-05-15
Posts: 47

Re: Time limit!

Nice game!

Try using the Timer from the Sensing commands:

When Green Flag Clicked - Reset Timer  (you need to do this for each level too)

When testing if touching Sprite3 include a test:

if Timer < 45
Broadcast Win
Else
Broadcast Lost

Instead of 45 make a variable and reduce the value for each level.

Offline

 

#3 2007-06-07 15:19:08

donkeyscommand
Scratcher
Registered: 2007-06-03
Posts: 10

Re: Time limit!

When I press the Green Flag it only has the white outline for a second and dosen't work!

Offline

 

#4 2007-06-07 16:44:33

Duncan
Scratcher
Registered: 2007-05-15
Posts: 47

Re: Time limit!

donkeyscommand wrote:

When I press the Green Flag it only has the white outline for a second and dosen't work!

You should not need to change anything so that it stops working. Just add the timer bits.

http://www.duncanmoran.me.uk/steady.jpg

This is the general idea - although this will not reset for each level etc, etc.

Offline

 

#5 2007-06-09 08:47:17

donkeyscommand
Scratcher
Registered: 2007-06-03
Posts: 10

Re: Time limit!

Thanks but how do you see the timer because I'm not sure it works.

Offline

 

#6 2007-06-09 08:57:30

donkeyscommand
Scratcher
Registered: 2007-06-03
Posts: 10

Re: Time limit!

Never mind I think what I'll do is I'll do a number coundown changing "costumes" each second and when I recieve lose return to beggining.

Is that right?

Offline

 

#7 2007-06-24 15:58:53

oolacrosse
Scratcher
Registered: 2007-06-23
Posts: 2

Re: Time limit!

Does anyone know how to add the score on a game, so that when the shark eats the fish, points are added, but when the shark eats the sunglasses, the time resets and the game is over? please help!

Offline

 

#8 2007-06-24 19:01:24

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Time limit!

make a variable for all sprites called "score"

have a big game over sprite

when green flag clicked
    hide
    set score to 0

when I receive eat_fish
    change score by 1

when I receive eat_sunglasses
    show
    move to front
    stop all

Offline

 

#9 2008-09-26 12:34:45

Marine43753
Scratcher
Registered: 2008-08-25
Posts: 16

Re: Time limit!

put this in a random sprite....[blocks]<when green flag clicked><set{ time }to( 50<forever><change{ time }by( 1<(<if><( <{time  }> <=>0  )><wait1secsc><stop all>[/blocks]

Offline

 

#10 2008-09-26 12:41:16

Marine43753
Scratcher
Registered: 2008-08-25
Posts: 16

Re: Time limit!

put this in a sprite....[blocks]( <when green flag clicked><set{time  }to( 50(<forever><change{time  }by( -1<if><{( time <=> 0 )<stop all>) [/blocks]

Hope that helps.

Offline

 

#11 2009-08-21 01:33:10

17640
Scratcher
Registered: 2009-07-26
Posts: 1

Re: Time limit!

how do you make it so that after a certain amount of time the game stops?????

Offline

 

#12 2009-08-21 05:12:09

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Time limit!

17640 wrote:

how do you make it so that after a certain amount of time the game stops?????

When the green flag is clicked, you make the game reset the timer. Make it so when the timer equals a certain amount, it stops all.

If this doesn't work, use a variable instead.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#13 2009-08-21 13:54:55

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

Re: Time limit!

Jonathanpb wrote:

17640 wrote:

how do you make it so that after a certain amount of time the game stops?????

When the green flag is clicked, you make the game reset the timer. Make it so when the timer equals a certain amount, it stops all.

If this doesn't work, use a variable instead.

Better yet, make it so that when the timer is GREATER than a given amount, it stops all.  It's not a good idea to try to test on an exact comparison of a floating point number (number with a decimal place in it).  The internal representation of the number doesn't always line up with what you see on the variable display and the match might not happen.


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

Offline

 

#14 2009-11-11 23:04:31

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Time limit!

Paddle2See wrote:

Jonathanpb wrote:

17640 wrote:

how do you make it so that after a certain amount of time the game stops?????

When the green flag is clicked, you make the game reset the timer. Make it so when the timer equals a certain amount, it stops all.

If this doesn't work, use a variable instead.

Better yet, make it so that when the timer is GREATER than a given amount, it stops all.  It's not a good idea to try to test on an exact comparison of a floating point number (number with a decimal place in it).  The internal representation of the number doesn't always line up with what you see on the variable display and the match might not happen.

Ooh! I remember now... Scrach doesn't seem to sense quick things like using the equal sign. Using the greater sign would work better.

I'm replying to your post from over two months ago!  tongue


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#15 2009-11-25 07:55:44

lu9
Scratcher
Registered: 2009-05-19
Posts: 56

Re: Time limit!

I've make a time limit for mario game, <when green flag clicked> <forever><wait( 1 )secsc><change{ timer }by( -1 )   this is for 1 second, okay?  big_smile


Talk about Scratch,Super Mario Bros X, Super Mario War and Lego Stunt Rally in my forum

Offline

 

Board footer