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

pressed and released event with stick of gamepad

Discussion in 'Legacy GameMaker Community Tech Support' started by Freeflip, Jan 19, 2020.

  1. Freeflip

    Freeflip Member

    Joined:
    Mar 16, 2018
    Posts:
    3
    Hi, with the stick of gamepad, how can I simulate the pressed and released event?

    for example:
    k_left_p = keyboard_check_pressed(vk_left) or gamepad_button_check_pressed(0, gp_padl) or PUT CODE HERE;

    or

    k_left_r = keyboard_check_released(vk_left) or gamepad_button_check_released(0, gp_padl) or PUT CODE HERE;

    some idea?

    Thanks
     
  2. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    Have additional variables to store the button's state each step. Before updating the state, check if the button is pressed but wasn't the previous step - that's a Pressed event. On the other hand, if it's pressed the previous step but isn't pressed down this step, that's a Released event.
     
  3. Freeflip

    Freeflip Member

    Joined:
    Mar 16, 2018
    Posts:
    3
    Thanks, now is ok
     

Share This Page