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

#1 2012-04-27 22:41:50

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

If <within 10 seconds <touching sprite 1>>

I think this would be a good block:

<within () seconds <>> //the thing after "seconds" looks wrong
This would be a green block, and it would give the amount of seconds to continue on, so heres what I mean:
when gf clicked
Move (10) steps //just for show
If <within (7) seconds <touching [sprite 2 v]?>>
  Say [hi] for (2) seconds
End
Say [the end]
All the random scripts are not needed and are just for show. What it would do is if within the next 7 seconds the sprite touches sprite 2, it would do the script. This could be very helpful.
    One problem with this block would be this:
Wait until <within (5) seconds <touching [sprite 2 v]?>>
It makes no sense, right? This would appear red if this script would be performed. Also,
Forever if
Would not work, but this block could still be useful.

Last edited by turkey3 (2012-04-27 22:49:33)

Offline

 

#2 2012-04-27 22:44:59

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: If <within 10 seconds <touching sprite 1>>

How is the program supposed to predict the future?

Edit: Oh, nevermind. I was thinking it would be better if there was a block like this

<[] seconds passed>
Except a boolean so it could be like this
repeat until <<[5] seconds passed>or<touching [sprite 2 v]?>>
do stuff
end

Last edited by TorbyFork234 (2012-04-27 22:47:24)

Offline

 

#3 2012-04-27 22:49:17

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: If <within 10 seconds <touching sprite 1>>

TorbyFork234 wrote:

How is the program supposed to predict the future?

I think It's meant as if touching within 10 seconds after it's called.
workaround time!

when gf clicked
broadcast [start timer v]
repeat until <(time) = (seconds wanted)>
if <touching [sprite1 v]?>
do stuff
end
end

When I receive [start timer v]
wait (seconds wanted) secs
set [time v] to (seconds wanted)


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

#4 2012-04-28 01:56:57

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: If <within 10 seconds <touching sprite 1>>

TorbyFork234 wrote:

How is the program supposed to predict the future?

It waits that number of seconds or until the condition is true. If the condition is still false after the specified time, it returns false.

This block will also be the only possible way to have a

<[thisisabroadcast v] received > 
block, as it can only work in
 wait until<>
repeat until <>
only 1 block inside - no more
end
forever if <>
only 1 block inside
and the
 <<> and <>> 
<<> or <>> 
<not <>> 
blocks inside the above blocks, and when the broadcast is constant (when it is being repeated) . But with this new block, the received block will work properly !

Last edited by joefarebrother (2012-04-28 02:00:57)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#5 2012-04-28 02:56:18

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: If <within 10 seconds <touching sprite 1>>

Doesn't anyone see my edit?

Offline

 

Board footer