Set Cursor Position

  • #1, by CrossSunday, 16. August 2015, 14:00 9 years ago
    Dear community,
    a couple of short cursor-related questions / requests:

    1. I'm trying to set the cursor position relativ to the current character position (e.g. 50 pixels left of character), but fail miserably, since my scripting is even worse than my english. Could a kind member probably help me out?

    2. Is it possible to have more than one active cursor at once? and/or

    3. Is it possible to set a different "shape" as center of a cursor (instead of a point of one pixel), like for example a line?

    I'm looking for options for a shooting mechanic in visionaire, that does not rely on using the mouse for aiming, since it's keyboard/gamepad-controls.

    Thanks for your help,

    Cross

    Newbie

    92 Posts


  • #2, by SimonSSunday, 16. August 2015, 14:16 9 years ago
    Hi,

    1. should be like this: setCursorPos({x=game.CurrentCharacter.Position.x-50, y =game.CurrentCharacter.Position.y})

    2. why ? Do you have 2 mice ?

    3. No. I'm not sure what you're trying to accomplish.

    You could move the cursor position also with keyboard if you script that, gamepad controls are also possible, more control over that is coming in the next release.

    Thread Captain

    1581 Posts

  • #3, by CrossSunday, 16. August 2015, 14:33 9 years ago
    1. Thank you very much Simon! grin Vielen, lieben Dank!

    2. Two, five or ten cursors next to each other form...

    3. ...a line, that's why i asked. Like in the picture below, instead of having one cursor attached to the players direction/position having a line to "aim".


    Newbie

    92 Posts

  • #4, by CrossSunday, 16. August 2015, 18:52 9 years ago
    I found a workaround / solution for what i'm trying to achieve, so just in case someone else is struggeling with shooting mechanics for gametypes like "Lone survivor" or the early "Resident Evil"-Games, i'll post it here:

    The key is to think of the active cursor as the bullet of your characters weapon! With Simons line of code you can set a starting position for the cursor in front of your weapon when your shoot-action is triggered and use the same line of code to move the cursor very quickly in a straight or diagonal line to the end of the screen, if you set up a loop action for a code like this for example:

    local curPos = getCursorPos()
    setCursorPos({x=curPos.x+10, y=curPos.y})

    Within the same loop you must have a command executed, that is tied to your cursor and voilá: you have a bullet-collision-detection-mechanic that works pretty much like illustrated in the picture above and can be controlled with keyboard or gamepad.
    Of course you need the loop to end either after a certain distance or time (that way you could have different melee-weapons with different reach) and you should probably set the cursor invisible.

    Newbie

    92 Posts

  • #5, by tristan-kangSunday, 16. August 2015, 20:10 9 years ago
    I always wondered if this Visionaire Studio can handle the genre you're making.

    I should follow your work to see it.

    Great Poster

    267 Posts