Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Please help with room escape game!
- Scorched-Wolf
-
Scratcher
9 posts
Please help with room escape game!
I am a beginner at Scratch and I have followed a tutorial by Kristine Kopelke & Colleen Stieler-Hunt to make a room escape game. It is shared at https://scratch.mit.edu/projects/192523394/. Many thanks to them for the instructions. Please help with two problems I have:
1) How do I get the paper to appear when I put the key in the inventory on the locked box in the inventory?
2) How do I allow the player to type three numbers on the door lock and make the right numbers open the door? At the moment, collecting four objects in the inventory should open the door but it does not work because the fourth object (the paper) does not appear.
Many thanks
1) How do I get the paper to appear when I put the key in the inventory on the locked box in the inventory?
2) How do I allow the player to type three numbers on the door lock and make the right numbers open the door? At the moment, collecting four objects in the inventory should open the door but it does not work because the fourth object (the paper) does not appear.
Many thanks

- beantheboy12
-
Scratcher
7 posts
Please help with room escape game!
You seem to have only 3 fruits. The lock accepts 2 5 9 Change the five to a 3 and the second problem is fixed.
As for problem number 1, make a variable. I'm going to call it unLockFound. Here's some basic code. Ask me questions about it later though. This is also a simple script. could be more efficient, but it would be unclear
<> = sensing (boolean)
() = string/number
{} = control flow brackets
PUT THIS SCRIPT INTO BOTH THE BOX AND THE KEY
whenFlagIsClicked{
set unLockFount to (0)
forever{
if <touchingMousePointer> {
if <mouseDown>{
change unLockFound by (1)
if <(unLockFound) = (2)> {
brodcast unlockbox
}
stop (this script)
}
}
}
}
As for problem number 1, make a variable. I'm going to call it unLockFound. Here's some basic code. Ask me questions about it later though. This is also a simple script. could be more efficient, but it would be unclear
<> = sensing (boolean)
() = string/number
{} = control flow brackets
PUT THIS SCRIPT INTO BOTH THE BOX AND THE KEY
whenFlagIsClicked{
set unLockFount to (0)
forever{
if <touchingMousePointer> {
if <mouseDown>{
change unLockFound by (1)
if <(unLockFound) = (2)> {
brodcast unlockbox
}
stop (this script)
}
}
}
}
- beantheboy12
-
Scratcher
7 posts
Please help with room escape game!
When I said unLockFount, I meant unLockFound
- beantheboy12
-
Scratcher
7 posts
Please help with room escape game!
when green flag clicked
set [ unLockFound] to [0]
forever
if <touching [mouse pointer] ?> then
if <mouse down?> then
change [unLockFound] by (1)
if <(unLockFound) = [0]> then
broadcast [unLockBox]
stop [this script]
end
broadcast [key found]
end
end
end
- Scorched-Wolf
-
Scratcher
9 posts
Please help with room escape game!
Thanks for your help - it works now!
- Discussion Forums
- » Help with Scripts
-
» Please help with room escape game!

