How to implement a simple open door with control panel puzzle?

  • #1, z mutajonThursday, 22. June 2017, 07:33 hodinky 7 years ago
    Hey,

    I'm very new, watched a bunch of tutorials and started playing with the program. Got my head around setting up scenes, characters, items and objects and using actions.

    I want to have a locked door with a control panel on the side.
    If the player clicks the panel a zoomed in pop-up opens (similar to pic) where he can enter a code (or close the pop-up if he doesn't have the code yet).

    Is this something complicated to implement? What would be the simplest approach to achieve this (preferably without coding)?

    Thanks!


    Bažant

    11 Posts


  • #2, z ke4Thursday, 22. June 2017, 09:39 hodinky 7 years ago
    Hi,

    this is not hard to implement. You will need one value for storing the information. Let's say it's a value called password.
    Wou would create each button as an object and under every button you would have action adding the current character to the value's string.

    Values["password"].String = Values["password"].String .. character

    On the delete button you would remove the last character

    Values["password"].String = string.sub(Values["password"].String, 1, -2)

    And on the cancel you would clear the whole value

    Values["password"].String = ""

    Then whenever you need it you just compare the value with your password

    if Values["password"].String == "4587" then
      startAction("Scenes[scene_name].SceneActions[action_name]")
    end

    You also need to figure out displaying the numbers. You could probably use four 10frames animations. Each frame a number from 0 to 9. You could set the current displayed frame based on the pressed button and basedon the number of characters in the string. 2 characters means second slot - second animation.

    ActiveAnimation["slot01"].FirstFrame = 2
    ActiveAnimation["slot01"].LastFrame = 2

    I suppose you could achieve it without coding either but it's just simpler to use the code.

    Zabiják klíčů

    810 Posts

  • #3, z mutajonThursday, 22. June 2017, 09:57 hodinky 7 years ago
    Thanks for the detailed response!
    I'll have to see if I can manage the code thing, and excatly how to integrate the code to the object (didn't get into it at all yet).

    Also, how would I go about displaying the zoomed view of the control panel? Is it easiest to just create it as a seperate scene? Or will a small pop-up window will be simpler to implement (via hide/show actions or something).

    Bažant

    11 Posts

  • #4, z sebastianThursday, 22. June 2017, 10:12 hodinky 7 years ago
    you could either create a new scene (menu) or creating an interface which you can show/hide via action part

    Kapitán

    2346 Posts

  • #5, z ke4Thursday, 22. June 2017, 10:13 hodinky 7 years ago
    Depends on what you want it to look like. The easiet way is to create a new scene for that.

    Zabiják klíčů

    810 Posts

  • #6, z mutajonThursday, 22. June 2017, 10:24 hodinky 7 years ago
    Ok. I'll try it all out and see what I come up with.
    Thanks!

    Bažant

    11 Posts