I am tryin to make a level select button and want to know if i can make it so you type a certan word or phrase and it changes level i know how to make it change level by clicking but not with typing a word please help
Offline
Try using the "question" block. Hang, on, I'm sure I have something exlpain this somewhere. I'll dig it up and post it here.
Unless someone beats me with an explanation
Edit:
Edit 2: Woopsies. Didn't realise BB codes was off. Here it is
http://scratch.mit.edu/projects/Stickman704test/1114755
Last edited by Stickman704 (2010-06-10 14:54:21)
Offline
Stickman704 wrote:
Unless someone beats me with an explanation![]()
Good idea
To create this, you need the ask and answer functions from sensing. Then make something like this:
[when flag clicked]
[ask (Password?) and wait]
[if <(answer) = ( LEVEL 1 PASS HERE )>]
[broadcast [level1 v] ]
[else]
[if <(answer) = ( LEVEL 2 PASS HERE )>]
[broadcast [level2 v] ]
[else]
[if <(answer) = ( LEVEL 3 PASS HERE )>]
[broadcast [level3 v] ]
[else]
[if <(answer) = ( LEVEL 4 PASS HERE )>]
[broadcast [level4 v] ] (you can repeat this over and over as many times as you like)
[else]
[say (Incorrect Password)]
Then, on the stage, put:
[when I recieve [level1 v] ]
[switch to background [level1 v] ]
Hope this helps
Offline
Tyvvm Wolfie
Offline
> Wolfie1996 wrote:
>
Stickman704 wrote:
Unless someone beats me with an explanation![]()
Good idea
To create this, you need the ask and answer functions from sensing. Then make something like this:
[when flag clicked]
[ask (Password?) and wait]
[if <(answer) = ( LEVEL 1 PASS HERE )>]
[broadcast [level1 v] ]
[else]
[if <(answer) = ( LEVEL 2 PASS HERE )>]
[broadcast [level2 v] ]
[else]
[if <(answer) = ( LEVEL 3 PASS HERE )>]
[broadcast [level3 v] ]
[else]
[if <(answer) = ( LEVEL 4 PASS HERE )>]
[broadcast [level4 v] ] (you can repeat this over and over as many times as you like)
[else]
[say (Incorrect Password)]
Then, on the stage, put:
[when I recieve [level1 v] ]
[switch to background [level1 v] ]
Hope this helps
[/blocks]
Beat you by one minute. Sorry
You can keep the cookie you were about to give me for your efforts
Last edited by Stickman704 (2010-06-10 15:17:20)
Offline
You do something like this:
[blocks]
<when[ sprite2 ]clicked>
[/blocks]
ask (what is the level 2 password?)
[blocks]
<if><( answer <=>(whatever the password is )>
<broadcast[level2>
<end>
[/blocks]
I hope this helps!
Last edited by thezofie1 (2010-06-10 22:03:09)
Offline
Like a lot of people said, you could use the ask block.
http://img816.imageshack.us/img816/3802/help.gif
Since the images doesn't work, use the link. The colors are a bit off, but it should help.
Hope it helps.
Offline
You can actually do the same thing that Wolfie mentioned above with a lot less code. You just need a list with all the passwords in it.
ask ["Password, please?"] set i to 0 set index to 0 set break to 0 repeat until (i = length of [passwords] or break = 1): change i by 1 if( item i of [passwords] = answer ): set level to i set break to 1 end end broadcast[join ["level"](level)]
But then I have a habit of making things more complicated than they need to be
Offline