Locks & Keys in editor (how does it work?)


#1

Hello,

i’ve no idea how to connect a lock with a gate or something like that.
Anyone who could help me out?

thanks
mad


#2

Unfortunately, this is one place where the editor falls short - you must edit the level in a text editor to connect locks and keys (or I think, more specifically, to lock doors with specific colored locks). I don’t know the specifics, but you could either open up a level that has them and see how it works, or wait for someone who does know.


#3

:frowning: Yeah, what we have right now is unfortunately “smoke and mirrors”.

The door or gate in question, when created, creates a visible “lock” on top of it. When you make a key bump into it (or try to unlock it with a key being carried), it makes the lock shatter.

It keeps track of whether it’s “locked” or not, and if it’s locked, it refuses normal “open it up” commands. Furthermore, once you unlock it, it sets an “event” in the player object saying that you unlocked that door. Every time the level starts out again, it checks back on that event; if you unlocked that door some time before (in that saved game), it starts itself out “unlocked” rather than locked.

Nothing inside a level gets saved, unless we do something like this. Every time you begin a level, everything in it starts out exactly like we created the level; “factory fresh”.


#4

I hope that this “mini-tutorial” I wrote can be easy enough to understand:

http://www.frogatto.com/forum/index.php?topic=235.msg1187#msg1187