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

#1 2010-06-10 14:44:44

sorathesec
Scratcher
Registered: 2010-06-10
Posts: 2

How do i make a level password?

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

 

#2 2010-06-10 14:47:43

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: How do i make a level password?

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  smile

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)


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#3 2010-06-10 14:55:35

Wolfie1996
Retired Community Moderator
Registered: 2009-07-08
Posts: 1000+

Re: How do i make a level password?

Stickman704 wrote:


Unless someone beats me with an explanation  smile

Good idea  tongue

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  smile


"...Jargon - the practice of never calling a spade a spade, when you might instead call it a manual earth-restructing implement..." - Bill Bryson, Mother Tongue

Offline

 

#4 2010-06-10 15:12:18

sorathesec
Scratcher
Registered: 2010-06-10
Posts: 2

Re: How do i make a level password?

Tyvvm Wolfie

Offline

 

#5 2010-06-10 15:16:59

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: How do i make a level password?

> Wolfie1996 wrote:

>

Stickman704 wrote:


Unless someone beats me with an explanation  smile

Good idea  tongue

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  smile

[/blocks]
Beat you by one minute. Sorry  smile 

You can keep the cookie you were about to give me for your efforts  smile

Last edited by Stickman704 (2010-06-10 15:17:20)


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#6 2010-06-10 22:01:42

thezofie1
Scratcher
Registered: 2010-02-16
Posts: 23

Re: How do i make a level password?

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!  big_smile

Last edited by thezofie1 (2010-06-10 22:03:09)


http://oi53.tinypic.com/nqbkld.jpg

Offline

 

#7 2010-06-10 22:39:15

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: How do i make a level password?

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.


Hai.

Offline

 

#8 2010-06-11 23:34:12

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: How do i make a level password?

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.

Code:

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  big_smile


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer