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

#1 2011-12-28 10:56:29

Smileyspongebob
Scratcher
Registered: 2011-11-10
Posts: 90

Doorway color- Please Help!

On my game, I put a script on a blaack line to put in a doorway so that when the main character touches it, it will go to the next room, but it's not working! The script I put on the line is

When green flag clicked
[if]
color <black> is touching color <brown>
broadcast <blubar2room>
[/if]
hide
Is there anything wrong with it?

Last edited by Smileyspongebob (2011-12-28 10:58:08)


http://i48.tinypic.com/2hn5eo9.png

Offline

 

#2 2011-12-28 11:04:51

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Doorway color- Please Help!

change the script to:
When green flag clicked

wait until <color <black> is touching color <brown>>
broadcast <blubar2room>

hide


http://i.imgur.com/1QqnHxQ.png

Offline

 

#3 2011-12-28 11:43:53

Smileyspongebob
Scratcher
Registered: 2011-11-10
Posts: 90

Re: Doorway color- Please Help!

TRocket wrote:

change the script to:
When green flag clicked

wait until <color <black> is touching color <brown>>
broadcast <blubar2room>

hide

Thanks  big_smile  but whats the difference between 'if' and 'wait until'? Just wondering  smile


http://i48.tinypic.com/2hn5eo9.png

Offline

 

#4 2011-12-28 11:48:18

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Doorway color- Please Help!

Smileyspongebob wrote:

TRocket wrote:

change the script to:
When green flag clicked

wait until <color <black> is touching color <brown>>
broadcast <blubar2room>

hide

Thanks  big_smile  but whats the difference between 'if' and 'wait until'? Just wondering  smile

wait until stops the rest of the script running until the statment is true(checkss it lots of times) the if block checks it once


http://i.imgur.com/1QqnHxQ.png

Offline

 

#5 2011-12-28 11:50:55

Smileyspongebob
Scratcher
Registered: 2011-11-10
Posts: 90

Re: Doorway color- Please Help!

TRocket wrote:

Smileyspongebob wrote:

TRocket wrote:

change the script to:
When green flag clicked

wait until <color <black> is touching color <brown>>
broadcast <blubar2room>

hide

Thanks  big_smile  but whats the difference between 'if' and 'wait until'? Just wondering  smile

wait until stops the rest of the script running until the statment is true(checkss it lots of times) the if block checks it once

Ohhhh! Thank you SO much!!  big_smile


http://i48.tinypic.com/2hn5eo9.png

Offline

 

#6 2011-12-28 14:51:36

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Doorway color- Please Help!

An alternate idea to ensure that you can use the same script would be to encapsulate the "if" block in a forever block.  Actually, to get the best performance, put the "wait until" block in a forever block so it checks for it again on the next level.


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#7 2011-12-28 21:09:58

Smileyspongebob
Scratcher
Registered: 2011-11-10
Posts: 90

Re: Doorway color- Please Help!

Kileymeister_test wrote:

An alternate idea to ensure that you can use the same script would be to encapsulate the "if" block in a forever block.  Actually, to get the best performance, put the "wait until" block in a forever block so it checks for it again on the next level.

That's a really good idea!  big_smile  Thanks!


http://i48.tinypic.com/2hn5eo9.png

Offline

 

Board footer