Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Tigersteel |
I am wondering if there is a way to disable the _physics_function(delta) function. I tried using set_process(false) and that didn’t work.
What’s the goal exactly? If you don’t want the function to do anything, don’t put any code in it. I assume that’s not what you’re after, but I’m not sure I understand the ask.
jgodfrey | 2022-12-19 15:07
I have some code in the physics process delta function but I want to disable that code because when the player dies and does its death sequence it keeps following the code under the physics process function and I don’t want it to do that.
Tigersteel | 2022-12-19 15:13
So, in that case, you probably want to just put some sort of boolean guard around the logic you want to “skip” when your player dies. Something like:
var alive = true
func _physics_process(delta):
if alive:
# do normal "alive" processing
Then, when your player “dies”, just set the alive
variable to false
to skip the _physics_process()
logic.
jgodfrey | 2022-12-19 15:16
That worked thank you so much
Tigersteel | 2022-12-19 15:21