Charakter follow left mouse button on hold

  • #1, by tabbesSunday, 20. December 2020, 21:05 3 years ago
    Is it possible to navigate the character by holding down the left mouse button? In addition to the simple left click. I didn't find anything under mouse options and my Lua attempts failed. 

    Newbie

    4 Posts


  • #2, by afrlmeSunday, 20. December 2020, 21:27 3 years ago
    Technically it should be possible. You would need at least 2 things to make it work.

    1. A mouse event handler to listen out for when mouse hold state is active & when it's released. When hold state is activated you would want to create & start a mainLoop to update the destination position to the mouse position on each loop or every x amount of loops.

    Alternatively instead of a mouse event handler you could use the mouse actions area inside of the main game settings area of the Visionaire Studio editor to setup when to start/kill the mainLoop function you want to use for controlling the characters destination position.

    2. A mainLoop function for controlling the characters destination position.

    Is there any particular reason you are wanting to use this type of system for controlling the character? It's not a very efficient system compared to just single &/or double clicking the mouse.

    Imperator

    7278 Posts

  • #3, by tabbesSunday, 20. December 2020, 21:47 3 years ago
    Thank you! I'm still quite new to Lua but I'll give it a try. 

    I'm planning a few scenes where the character walks down a long street. Like in Thimbleweed park. There the control is also solved this way and I find it quite intuitive.

    Newbie

    4 Posts

  • #4, by afrlmeSunday, 20. December 2020, 21:56 3 years ago
    Thank you! I'm still quite new to Lua but I'll give it a try. 

    I'm planning a few scenes where the character walks down a long street. Like in Thimbleweed park. There the control is also solved this way and I find it quite intuitive.
    I have that game, but I haven't gotten round to playing it yet - probably never will - so I've no idea how intuitive it is or why they would use that sort of system, but ok sure, I'll just have to take your word for it. wink

    Anyway, if you get stuck with something just post on here, or alternatively join our discord server @ https://discord.gg/g5zFejW, as we are a lot more active on there than the forum.

    Imperator

    7278 Posts