Legacy GM Massive control lag

G

Guest User 1

Guest
Here's my code for camera movement:
Code:
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.
 
Top