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

#1 2012-08-26 17:50:42

oshe10
Scratcher
Registered: 2012-06-21
Posts: 92

Key and door?

i was making a platformer that you would need a key to get to the end. I don't know how to program it. HELP!


http://i.imgur.com/w4rS6.jpg

Offline

 

#2 2012-08-26 17:55:04

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Key and door?

For the key, you'll need something like this:

when gf clicked
set [key v] to (0)
show
wait until <touching [character v]?>
set [key v] to (1)
hide
And you'll need something like this for the door:

when gf clicked
forever
 if <(key) = (0)>
  show
 else
  hide
 end
I hope that this helps!

Last edited by ErnieParke (2012-08-26 17:55:30)


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2012-08-26 17:59:48

oshe10
Scratcher
Registered: 2012-06-21
Posts: 92

Re: Key and door?

ErnieParke wrote:

For the key, you'll need something like this:

when gf clicked
set [key v] to (0)
show
wait until <touching [character v]?>
set [key v] to (1)
hide
And you'll need something like this for the door:

when gf clicked
forever
 if <(key) = (0)>
  show
 else
  hide
 end
I hope that this helps!

Thanks!!


http://i.imgur.com/w4rS6.jpg

Offline

 

#4 2012-08-26 18:16:03

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Key and door?

when I receive [new level v]
hide
wait until <(key) = (1)>
show
would be a simpler way


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#5 2012-08-26 18:19:40

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Key and door?

zammer990 wrote:

when I receive [new level v]
hide
wait until <(key) = (1)>
show
would be a simpler way

I know, but this would allow you to add special effects.

Ex. Rainbow doors.


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer