0 votes

So i been making a poison fog that when someone enter and stay they will get continuous damage the only problem is they only get damage once when they first enter,is there a way to fix this?(I'm only a beginner in godot)

in Engine by (29 points)

2 Answers

0 votes

var in_fog = false
var damage = the damage you want
const PLAYER = preload(the player scene)

in the fog area entered function:
in_fog = true

in the fog area exited function:
in_fog = false

in the process function:
var player = PLAYER.instance()
player.health -= damage*delta

hope it works (:

by (291 points)
0 votes

I doubt you want to damage player every frame, so I recommend you add a Timer node to your "someone" scene. And enable timer if you enter poison cloud, and disable timer if you leave the poison cloud. Do the dmg in your timeout signal of the Timer.

by (206 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 Frequently asked questions and 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 [email protected] with your username.