+1 vote

when collision is detected I want health to be subtracted from -10 only

if get_colliding_bodies():
    health -= 10

but only once and not progressively since godot is subtracting 10 from me each frame, that is, I want life to remain at 90 and only subtract once, not to progressively lower until it remains at 0

in Engine by (187 points)

1 Answer

0 votes

Brother
makes a varieble that is like
var damage = false
then you put what
if damage == false:
hp - = 10
damage = true

and later if you want to put as a timpo so that it can hurt again you use a timer node and put in the if $Timer. start then create the timer out sign and put the damege var to be false so that the lifetime

by (52 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.