1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GM:S 1.4 Massive control lag

Discussion in 'Programming' started by Guest User 1, Apr 23, 2017.

  1. Guest User 1

    Guest User 1 Guest

    Here's my code for camera movement:
    if      ( keyboard_check( ctrl_up    ) ) {
        target_y -= 10 ;
    }else if( keyboard_check( ctrl_down  ) ) {
        target_y += 10 ;
    if      ( keyboard_check( ctrl_left  ) ) {
        target_x -= 10 ;
    }else if( keyboard_check( ctrl_right ) ) {
        target_x += 10 ;
    x += ceil( ( target_x - x ) / 3 ) ;
    y += ceil( ( target_y - y ) / 3 ) ;
    When I run the game, there is a 1s delay between pressing a button and the button beginning to work. Once it's working, the button works with no lag, but this delay returns when a different button is pressed. If say the button for lft is pressed, but released before the lag stops, there is no movement. This all seems like the game needs to think about what control is being pressed before it can start making it work, and it only does this for one control at a time.

    I have tested this with reduced code, using vk_left and so on in each if statement and changing the x and y values directly, but this does not help. This is a problem I have never encountered before, and I have used this exact code before with no problems.

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