License from €75
DE EN FR ES IT CZ

Movement on the x-axis using keyboard ...<?>

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

  1. · 13 years ago
    Heya,

    I'm experimenting with VS for a few weeks now and everything was really great and simple, until I tried to create some custom functions smile. I know nothing about programming, but I thought it can't be that hard. Boy, was I wrong. Today is the third day I'm constantly researching, rewriting and looking at the functions of the demo project, but all i see is gibberish. At one point I actually started to cry grin I'm not able to do anything at all with the code.

    I wanted to make my character walk left and right using the A and D keys, exclusively on the x-axis. So I made a very narrow space with wayborders, and a single straight line of waypoints. The character was moving somehow how I wanted, but i had to use mouse. So the next step was to figure out how to control this movement with keyboard.
    I came up with a solution, or an idea for one. When the key "D" is pressed, I'd get current position of the character - which i presumed would be a coordinate (x,y) and tell the game to start increase the "x" by amout of 1 or 5 or whatever would work. Then on pressing "A" the "x" would start to decrease again. Well... that did not work. Mainly because I have no idea where to start - "Key actions" wants me to provide a link (Action part) to another function or script, called when the key is pressed, so I made....

    Ok, I see I'm probably not making much sense now. What I'm asking is - can anybody give me a hint or few bullet points for where to start with something like this (moving on x-axis using keyboard)? The wiki documentation is probably ment for someone who already knows a bit of lua.

    If I'm still confusing, please call me out and I will try to clarify.
  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. · 13 years ago
    Hello,

    please make a visit here, I wrote something about solutions to that problem:
    http://www.visionaire-studio.net/forum/thread/keyboard-movem...
  4. · 13 years ago
    Hi, thank you!

    The character is moving on the x-axis and all seems fine smile . I have only a little problem with the "stop character by an action part". I think I'm suppose to use the "jump to action part" function, but I'm not sure where to put the "started=false" line...
  5. · 13 years ago
    You can just use the action part "Stop character" and "start=false" is a script that's called afterwards, to reset the status.
  6. · 13 years ago
    Ah, ok then, thank you very much!!!

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?