How to apply animation/image replacement during set conditions?

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

There are other ways to do this but I am curious if this would work in general:
I have a series of timers that run in the background. [hit2.png] is used for both hit 2 and hit 5 strike animations. I need to set the conditions for hit 5 strike animation to be replaced by a [hit5.png] ONLY when [timer3] is active.

I’m still new to coding so I don’t know what the correct code for this would actually look like but here’s how I imagine it should function:

if [timer 3] is active
replace [hit2.png] with [hit5.png]

Any help is appreciated. Thanks in advance.

:bust_in_silhouette: Reply From: deaton64

Hello,

You can see what methods the timer has here: Godot Timer

In your code, you could do something like:

if $Timer3.get_time_left() = 0:
	replace [hit2.png] with [hit5.png]

Your timer is either running or it’s not:

if $Timer3.get_time_left() > 0:
	print("Counting down")
else:
	print("Timer is done")