Using one object to activate another object


My 3rd grade students want to do this: find a key, then carry that key with them to unlock a chest. In simple code, how can we do this?

PS: Thanks for all the quick help, CoSpaces!


Hi Kelly,

A variable can keep track of what the students are carrying.
Here’s an re-mixable example.
Let me know if you have any questions,



thanks tom. This is great!


I have done this too with my maze game. Here is a link to the remixable version.

In it you pick up a key to unlock a door, so could be easily adapted for treasure chests etc!