Posted August 19, 2025 by Bastian
version 3.5.2 topic tool ghost
Ok, strange thing happened today. I had this enemy troll ready to rumble towards the player at full speed and attack when all of sudden i see it moves by itself and never stops not even when i kill the running process.
Where is the problem? Well it seems the word “tool” and the beginning of the EnemyTroll.gd script is the reason. I needed it to be able to trigger the facing of the troll from the troll component setting that is not normally reachable because it is deeper in the AnimationSprite component. Thus i added it. Thus it works. But at the same time it will run the _process(delta) function and there i had the state calling code and the walk state function started to walk away each frame even if in editor.
So how to fix at least one bug i encountered in my way of doing wrong?
# do the states each update
func _process(delta):
# skip the code because the editor is on
if Engine.is_editor_hint() == true:
return
# run the code only in the play mode
match state:
EnemyState.WALK:
_state_walk(delta)
EnemyState.ATTACK:
_state_attack()
EnemyState.DEFEAT:
_state_defeat()