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

#1 2009-05-08 08:35:22

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

How do you "wait 3 seconds or until <touching player>" ?????

i'm trying to think of a way to stop a script, wait for either 3 seconds to pass or for the sprite to be touching the 'player'... i can do this using variable/timer/broadcast but what bout keeping it in one script without using the timer or variables.

i dnt think thrs a way - maybe the next scratch shud include something like:

Wait [  ] seconds or until <   >

i'll put this in suggestions aswell.

thx. dibbo.


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

#2 2009-05-08 10:29:19

BoltBait
Scratcher
Registered: 2009-03-09
Posts: 1000+

Re: How do you "wait 3 seconds or until <touching player>" ?????

You can easily do this with 2 scripts.

Create a variable called SecondsPast and set it to 0
Then have a script:

when Start received
set SecondsPast to 0
wait 3 seconds
set SecondsPast to 1

Then, have another script:

when Start received
wait until  (SecondsPast = 1) or (Touching PlayerSprite)
...
etc.

Hope this helps.

Last edited by BoltBait (2009-05-08 10:30:36)


Animated sigs must be banned!
http://boltbait.com/j.pnghttp://boltbait.com/s.pnghttp://boltbait.com/d.pnghttp://boltbait.com/a.pnghttp://boltbait.com/p.png

Offline

 

#3 2009-05-08 10:38:30

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: How do you "wait 3 seconds or until <touching player>" ?????

Just use

reset timer
wait until < key space pressed > or < timer>3 >

That should work.

If you already use the timer somewhere else in your program, use

set time to timer
wait until < key space pressed > or < timer > (time + 3) >


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#4 2009-05-08 10:50:53

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: How do you "wait 3 seconds or until <touching player>" ?????

JSO wrote:

Just use

reset timer
wait until < key space pressed > or < timer>3 >

That should work.

If you already use the timer somewhere else in your program, use

set time to timer
wait until < key space pressed > or < timer > (time + 3) >

yeh thx for the help but now i see that u cnt do it without the new block, variables, the timer or broadcasting.

i've used variables in the game im making now, although the script wud be 5 times as short if i had that block  tongue


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

#5 2009-05-08 10:58:58

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: How do you "wait 3 seconds or until <touching player>" ?????

not the most accurate way but:
<repeat( 30
if touching script with if and all
<wait( 0.08 )secsc>

dont quite want it to be 0.1 as each block has a little built in timer

Last edited by yambanshee (2009-05-08 10:59:18)

Offline

 

#6 2009-05-08 16:17:09

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do you "wait 3 seconds or until <touching player>" ?????

Dibbo222 wrote:

JSO wrote:

Just use

reset timer
wait until < key space pressed > or < timer>3 >

That should work.

If you already use the timer somewhere else in your program, use

set time to timer
wait until < key space pressed > or < timer > (time + 3) >

yeh thx for the help but now i see that u cnt do it without the new block, variables, the timer or broadcasting.

i've used variables in the game im making now, although the script wud be 5 times as short if i had that block  tongue

What block are you talking about? As far as I'm aware, all of the blocks in the script have always been there.

Offline

 

#7 2009-05-08 17:44:08

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: How do you "wait 3 seconds or until <touching player>" ?????

I think he means the < >and< > block.

But it already exists, just look in the Numbers tab.

<<  <and>  >>[/blocks]


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#8 2009-05-08 20:48:01

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: How do you "wait 3 seconds or until <touching player>" ?????

no, as said in the first post, this block:

Wait [  ] seconds or until <   >

<wait( << 3    >> <or> until     <touching[ player  >> )secs>


something like that above ^^


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

#9 2009-05-09 04:10:49

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: How do you "wait 3 seconds or until <touching player>" ?????

mine will do the trick. using existing blocks its the easiest alternative i can think off

Offline

 

#10 2009-05-09 09:36:52

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do you "wait 3 seconds or until <touching player>" ?????

Dibbo222 wrote:

no, as said in the first post, this block:

Wait [  ] seconds or until <   >
[blocks]
<wait( << 3    >> <or> until     <touching[ player  >> )secs>
[/blocks]

something like that above ^^

I think you're confusing [wait until < > ] and [wait ( ) secs]. JSO suggested using "wait until", which does exist. For clarification:

[blocks]
<reset timer>
<wait until><< <( <timer> <=> 4 )> <or> <touching[ sprite 1  >>
[/blocks]

That should work.

Last edited by coolstuff (2009-05-09 09:37:23)

Offline

 

#11 2009-05-09 11:39:44

Dibbo222
Scratcher
Registered: 2007-11-03
Posts: 100+

Re: How do you "wait 3 seconds or until <touching player>" ?????

coolstuff wrote:

Dibbo222 wrote:

no, as said in the first post, this block:

Wait [  ] seconds or until <   >
[blocks]
<wait( << 3    >> <or> until     <touching[ player  >> )secs>
[/blocks]

something like that above ^^

I think you're confusing [wait until < > ] and [wait ( ) secs]. JSO suggested using "wait until", which does exist. For clarification:

[blocks]
<reset timer>
<wait until><< <( <timer> <=> 4 )> <or> <touching[ sprite 1  >>
[/blocks]

That should work.

yes that shud work - but what if i had 10 sprites running the same script? the timer wud be all mucked up.

MAYBE a timer1, timer2, timer3 or a timer{ } (u choose the number of the timer u wish to use at this script. they're all seperate timers)


The biggest tower defense game on Scratch?
http://scratch.mit.edu/projects/Dibbo222/929092

Offline

 

#12 2009-05-10 06:58:27

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: How do you "wait 3 seconds or until <touching player>" ?????

Dibbo222 wrote:

yes that shud work - but what if i had 10 sprites running the same script? the timer wud be all mucked up.

MAYBE a timer1, timer2, timer3 or a timer{ } (u choose the number of the timer u wish to use at this script. they're all seperate timers)

using some very basic maths i could make a variable thats the same as the timer. I use it all the time in flash, as there is no real wait x seconds command

Offline

 

Board footer