GM:S 1.4 change sprite when button is pressed

Discussion in 'Programming' started by EZTALES, Mar 17, 2019.

  1. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    126
    .
     
    Last edited: Mar 17, 2019
  2. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    126
    .
     
    Last edited: Mar 17, 2019
  3. EZTALES

    EZTALES Member

    Joined:
    Apr 15, 2018
    Posts:
    126
     
  4. VagrantWhaleGames

    VagrantWhaleGames Member

    Joined:
    Jul 10, 2018
    Posts:
    58
    I think you're setting the sprite index to slide and never resetting it.

    Code:
    //attacking right
    if sprite_index = spr_player_R & keyboard_check_direct(ord("X"))
    {
    sprite_index = spr_player_slide_R;
    }
    else
    {
    sprite_index = spr_player_R
    }
    regardless, this is a bad way to set things up. I would recommend trying a very simple state machine to control your character, it will make sure he can only be doing one thing at a time and can't get his animations and other things mixed up.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice