A question about ternary ifs regarding performance
I've been using ternary ifs to build some easy buffers or timers, but i'm wondering about something:
timer -= 1.0 if timer > 0.0 else 0.0
When the timer hit zero it will be:
timer -= 0.0
This way would the timer still be running "deducing" -= 0.0 every frame? And if yes, would it be impactfull towards performance? (thinking on every buffer or timer i would make in the game, would be a lot of these running at the same time)
I was doing it this way:
if timer > 0:
timer -= 1
else:
timer = 0
I does look way worse in readability, but by the logic once it hits zero it just leave the statement since timer is no longer > 0, and then it will just check if timer > 0 every frame.
I know that there is the Timer node and etc... but honestly i don't really like to use it to keep my node tree cleaner. If i were to create them thru code, would be more work than these common code timers.