License from €75
DE EN FR ES IT CZ

Keyboard controls

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 12 years ago
    Hello, I would like to try to add an alternative gameplay in my game. I have a first person view (Myst-like) where it is possible to play with the mouse as usual, but I also try to allow the keyboard for navigation.

    Currently when the player clicks on a hotspot in the middle of the screen, he moves to the next frame. However, I try also to do the same when the player clicks on Z (for ZQSD commands /Azerty keyboards), or upper arrow.

    Do you see what I mean?
    It sounds easy to do, but I'm stuck roll
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.

    Get 15 % off Try it for free
  3. · 12 years ago
    There is a key actions tab in the main game tab in Visionaire or did you use that but it didn't work?
  4. · 12 years ago
    Thanks Ke4 smile
    Yes I know the key actions tab and I tried to use it, but I think I have not found the logic for this specific purpose.

    If I choose the Z key to move forward, for example:
    How can I really move forward on pressing Z ? Moving forward is different in every frame: the "next frame" could be the path on the right or the path behind. Gah! It's hard to explain!
    In fact the best solution would be in the Actions tab of each scene object, to have the possibility to add a key. Instead of choosing "on Left click", I would have to choose "on Z key pressed". Then I choose the good action.
  5. · 12 years ago
    Well don't know if that's a good idea but this is what i can think of grin

    I guess you could store in each scene the action for the move and it would be named in all scenes the same ( eg. "next frame" ) and everytime when you would press the Z key it would call the "next frame" action from the current scene
  6. · 12 years ago
    lol
    Yes it sounds like a working solution, and so easy to set up. I must start to be tired, I have been doing things much more complicated than that haha!
    Thanks A LOT! You saved me ^^
  7. · 12 years ago
    Don't worry i remeber how i was trying to set up a minigame with cables and i overcomplicated it so much grin

    The code would be something like
    startAction("Game.GameCurrentScene.SceneActions[nextFrame]")
    
  8. · 12 years ago
    Thanks for your help, but I think I'm going to give up. It's too much additional work if I have to manage a key for each hotspot that takes to a new place. There are a very lot of frames to visit, so... roll
  9. · 12 years ago
    I'm not sure what you mean now. You would be calling the action what you have already done for the mouse action in your scene.

    Or it's more complicated then just moving forward/backward?
  10. · 12 years ago
    You could create some Lua tables for each scene to determine which scene you should go to when pressing a specified direction key.

    Tables are relatively quick to type up. Much faster than creating a ton of actions parts & so on anyway.

    local t = {} -- create a new local table called "t"
    -- + --
    t["exterior"] = {n = "interior_n"}
    t["interior_n"] = {e = "interior_e", w = "interior_w", n = "reception_area", s = "interior_s"}
    -- etc.
    
    function changeScene(dir)
     if t[game.CurrentScene:getName()][dir] then
      game.CurrentScene = Scenes[ t[game.CurrentScene:getName()][dir] ]
     end
    end
    

    ... you only need to specify directions required for each scene. Then using the lua key handler or the key actions in the editor you have it execute a function that changes to the required scene based on the table of current scene & key that was pressed.
    changeScene("n")
    

    ... something along those lines. It's all theoretical of course though. As per! grin
  11. · 12 years ago
    “
    I'm not sure what you mean now. You would be calling the action what you have already done for the mouse action in your scene.

    Or it's more complicated then just moving forward/backward?
    „


    First person exploration games like Myst are always complicated in their own way, as they often have multiple views of the same scene from different angles (panoramic 360º views quite often); north, south, east & west. At a minimum there may only be one direction to go, but more often there will be 2 to 4 directions in each room & then possibly more depending on depth of room - close-ups etc.
  12. · 12 years ago
    Sound complicated enough. I thought that if there is in each scene classic object button for move (up, down, left, right) they could be named in each scene same and it would call always the "up" or "right" action from the current scene. But as you said, there are often different angles in each scene.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?