1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice
  2. NOTICE: We will be applying a Xenforo update on Tuesday 25th of February. This means that from approximately 10:00 to 14:00 BST the forums will be offline (or possibly longer). Sorry for the inconvenience! Official Announcement here.

GMS 2 Full analog movement with variable speed?

Discussion in 'Programming' started by Undead Hero, Jan 16, 2020.

  1. Undead Hero

    Undead Hero Member

    Joined:
    Jul 20, 2016
    Posts:
    73
    Hey. I’ve looked everywhere, but couldn’t find an answer to this.

    Is there a function in GM2 that that would allow you to change the speed a player moves at based on how far you’re moving an analog stick? ie, nudge the stick a little bit to move slowly, push it all the way to the edge to move quickly.

    Thanks!
     
  2. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    1,107
    Presumably gamepad_axis_value will be what you're looking for. The example code is more or less doing what you are asking for.
     
  3. Undead Hero

    Undead Hero Member

    Joined:
    Jul 20, 2016
    Posts:
    73
    I thought this was saying it would simply return -1 or 1, based on a left or right input. Does it get more granular than that with the analog sticks?
     
  4. samspade

    samspade Member

    Joined:
    Feb 26, 2017
    Posts:
    2,234
    Yes.
     
  5. Undead Hero

    Undead Hero Member

    Joined:
    Jul 20, 2016
    Posts:
    73
    Sweet, thanks.
     
  6. Sabnock

    Sabnock Member

    Joined:
    Jul 21, 2016
    Posts:
    364
    this is actually quite simple you just use the result of gamepad_axis_value as a multiplier.
     
  7. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,449
    Make sure you lower the threshold.
     

Share This Page