Movement on the x-axis using keyboard ...

  • #1, by BhidrThursday, 06. February 2014, 20:08 11 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.

    Newbie

    3 Posts


  • #2, by SimonSThursday, 06. February 2014, 20:15 11 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...

    Thread Captain

    1580 Posts

  • #3, by BhidrThursday, 06. February 2014, 22:00 11 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...

    Newbie

    3 Posts

  • #4, by SimonSThursday, 06. February 2014, 22:10 11 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.

    Thread Captain

    1580 Posts

  • #5, by BhidrThursday, 06. February 2014, 22:12 11 years ago
    Ah, ok then, thank you very much!!!

    Newbie

    3 Posts