look_dir -= ( window_mouse_get_x() - WINDOW_WIDTH / 2 ) / CAMERA_SENSITIVITY; look_pitch -= ( window_mouse_get_y() - WINDOW_HEIGHT / 2 ) / CAMERA_SENSITIVITY; look_pitch = clamp( look_pitch, -CAMERA_PITCH_MAX, CAMERA_PITCH_MAX ); window_mouse_set( WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2 ); var move_speed = 5; var dir_mod = 0; var up = 0; var down = 0; var left = 0; var right = 0; var ascend = 0; var descend = 0; if ( keyboard_check( ord("W") ) ) { up = 1; } if ( keyboard_check( ord("S") ) ) { down = 1; } if ( keyboard_check( ord("A") ) ) { left = 1; } if ( keyboard_check( ord("D") ) ) { right = 1; } if ( keyboard_check( vk_space ) ) { ascend = 1; } if ( keyboard_check( vk_control ) ) { descend = 1; } if ( keyboard_check( vk_escape ) ) { game_end(); } dir_mod = point_direction( 0, 0, (up - down), (right - left) ); if ( up || down || left || right ) { direction = look_dir + dir_mod; x += dcos( direction ) * move_speed; y += dsin( direction ) * move_speed; } if ( ascend ^^ descend ) { z = z + ascend - descend; }