Camera movement in combination with screen shake ... ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By IshiTheArtist

So I have a character with a stomp ability that gives out a screen shake effect, after this the character gains a movement speed buff and can start to move just when the screen shakes.

Now the problem is not the shake itself, but when the screen shake fades there is a little freeze like shutter.

I suspect it might have something to do with execution order or something.

the screen shake is defined in a script that is attached to a camera2d that follows the character.

having the camera as a child of the target or:

    global_position = get_node(target).global_position

…makes no difference.

reducing the shakes power to 0 also does not work.

here the script on the camera

extends Camera2D

export var decay = 0.7  
export var max_offset = Vector2(100, 75)  
export var max_roll = 0.1  
export (NodePath) var target  

var trauma = 0.0  
var trauma_power = 3  
var noise_y = 0
onready var noise =

func _ready() -> void:
	GlobalSignals.connect("animation_thump_finished", self,
	noise.seed = randi()
	noise.period = 4
	noise.octaves = 2

func _process(delta : float) -> void:
	if target:
		global_position = get_node(target).global_position
	if trauma:
		trauma = max(trauma - decay * delta, 0)

func add_trauma(amount : float) -> void:
	trauma = min(trauma + amount, 1.0)

func shake() -> void:
	var amount = pow(trauma, trauma_power)
	noise_y += 1
	rotation = max_roll * amount * noise.get_noise_2d(noise.seed, noise_y)
	offset.x = max_offset.x * amount * noise.get_noise_2d(noise.seed*2, noise_y)
	offset.y = max_offset.y * amount * noise.get_noise_2d(noise.seed*3, noise_y)

func _on_AnimationPlayer_animation_thump_finished():
:bust_in_silhouette: Reply From: IshiTheArtist

I realised like 10 seconds after posting this, using _physics_process(delta) instead of _process(delta) seems to fix it. Even though the camera process mode is set to idle and switching it to physics makes the shutter reappear.

:bust_in_silhouette: Reply From: Mrpaolosarino

Another way you can do this is by using AnimationPlayer and Tween. If this is walking bobbing with fixed distance then you can use AnimationPlayer. If this is explosion, then use tween