Click increment based movement.

stbrady23stbrady23 Member Posts: 3
edited July 2015 in Working with GS (PC)

Hello. I'm trying to get the user to click and a player object moves towards the mouse at first, but then slows to a stop. I do not want the user to be able to hold down the mouse. The player should only move on a click, and not a click-hold. How can I not allow the hold? Thanks very much, I am not a programmer :/

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    @stbrady23 said:
    ok that did it thank you! I had to select rather than type in.

    Yep, you have to select attributes, but the rest you can type in by hand, for example 'vectorToAngle' can be typed in (or selected from the pulldown if you want), but attributes can only be selected from the pulldown.

Answers

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2015

    Open the Physics attributes and change Drag to 200

    Rule - When mouse button is down
    --Change Velocity - Direction vectorToAngle( mouse x - self X , Mouse - self X)

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2015

    Or . . . .

    Open the Physics attributes and change Drag to 200

    Rule - When mouse button is down
    --Rule - When mouse button is UP
    ----Change Velocity - Direction vectorToAngle( mouse x - self X , Mouse - self X)

  • stbrady23stbrady23 Member Posts: 3

    Thanks for replying, but are you typing in "self" or the player object name (in my case "player"? Either way, I still can't get it to move. But here are my settings.

  • SocksSocks London, UK.Member Posts: 12,822

    @stbrady23 said:
    Thanks for replying, but are you typing in "self" or the player object name (in my case "player"? Either way, I still can't get it to move. But here are my settings.

    'Self X' refers to the actor's X position.
    'Self Y' refers to the actor's Y position.
    'mouse X' refers to the mouse's X position.
    'mouse Y' refers to the mouse's Y position.

    Select these attributes with the pull down menu rather than typing them in.

  • stbrady23stbrady23 Member Posts: 3

    ok that did it thank you! I had to select rather than type in. What it ended up being for me was:
    vectorToAngle(game.Mouse.position.x-self.position.x,game.Mouse.position.y-self.position.y)

Sign In or Register to comment.