Author Topic: Key and Lock for Secrets  (Read 708 times)

Free_Eagle

  • Level 3: Plugger
  • *
  • Posts: 31
    • View Profile
Key and Lock for Secrets
« on: October 12, 2023, 11:28:05 AM »
Hello me again :-[.

I'm so sorry, I tried to solve the problem for 2 days...

I want to unlock a secret path with a key and lock. As in the video Lesson 6 "Secret Exits"
I created the key and lock as an item myself.
Unlocking to secret works, but I can't say "with key".
Lock = blue
Key = blue
But the wombat walks past it with and without a key. Why?

!Addendum!

I changed "Pick up" to "Standard" for the lock
Now the wombat always goes into the lock, even without a key

« Last Edit: October 12, 2023, 11:34:09 AM by Free_Eagle »
Sorry for my bad english...

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Key and Lock for Secrets
« Reply #1 on: October 13, 2023, 07:46:41 PM »
I don't understand the question, sorry. can you help me visualize it?

Free_Eagle

  • Level 3: Plugger
  • *
  • Posts: 31
    • View Profile
Re: Key and Lock for Secrets
« Reply #2 on: October 15, 2023, 03:58:21 PM »
Oh ok.
A level can be completed normally. But it also has a lock and a key to find. The lock opens a secret level.
I created the key and lock myself as a "custom item".
Now I have the problem of telling the program that the lock can only be opened with the key.
I also tried with variables. I just can't find the "then"
if Key =1 then ....?
...or so
« Last Edit: October 15, 2023, 05:53:55 PM by Free_Eagle »
Sorry for my bad english...

Gizgord

  • average
  • Level 18: Statix
  • *
  • Posts: 835
    • View Profile
Re: Key and Lock for Secrets
« Reply #3 on: October 21, 2023, 07:28:15 PM »
This is how you would write a conditional:
if key=1
secret exit

However, I think you're better off using normal keys and gates instead of creating "custom" ones. You can place a real gate and then put whatever you want behind it, like a secret exit.

Free_Eagle

  • Level 3: Plugger
  • *
  • Posts: 31
    • View Profile
Re: Key and Lock for Secrets
« Reply #4 on: October 23, 2023, 04:31:35 PM »
Using the original key and door was my first attempt. Just "press" unlocking it and "press" going in, wasn't what I wanted. The avatar should go in straight away if the key fits.

I have defined the variable key = 0 in the "Area Settings".
Code: [Select]
"game var key = 0"
The lock was defined in "loop".
Code: [Select]
If key=1
secret exit

The key has not yet been defined to test it

But the avatar always goes in, even without a key.

I don't know why, because the variable key should be 0.
Sorry for my bad english...

Free_Eagle

  • Level 3: Plugger
  • *
  • Posts: 31
    • View Profile
Re: Key and Lock for Secrets
« Reply #5 on: October 26, 2023, 05:15:29 PM »
I've now managed to get it to work with the key and lock.
The problem was old settings that I no longer remembered while experimenting.
I am so sorry :-[.

Now I have the problem that the wombat picks up the lock.
Even without a key. The lock could always be shown because the wombat would then leave the level.

I couldn't find a "don't pick up" for the lock anywhere...
Sorry for my bad english...

Free_Eagle

  • Level 3: Plugger
  • *
  • Posts: 31
    • View Profile
Re: Key and Lock for Secrets
« Reply #6 on: November 13, 2023, 06:04:54 PM »
I assume there is no solution for this? ???
Sorry for my bad english...