Best way to slow down battle

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

We have an animated 3D space battle programmed. When I run the program, the entire battle happens so fast, all that we see is the ending surviving ships (300 laser shots, 150 space-ships exploding all invisible, because they happened too fast).

I was going to slow it down to 10 laser shots/second (at least as a first pass). I have two places in the _battle_resolution function where I would like to delay the code, just before the defensive fire laser and the attacking fire laser graphics function calls.

What is the best way to do this?

:bust_in_silhouette: Reply From: Wakatta
const SECONDS = 1000
export var cool_down = 3
var last_fire_time = OS.get_ticks_msec()
var current_time = OS.get_ticks_msec()

func _process(delta):
    current_time = OS.get_ticks_msec()
    if current_time - last_fire_time > cool_down * SECONDS:


var delta_time = 0
export var cool_down = 3.0

func _process(delta):
    delta_time += delta
    if delta_time > cool_down:
        delta_time = 0

or slow down the speed at which the projectiles move when fired

projectile.velocity.normalized() * delta * SPEED