tool ghosts
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?
- when changing scene put and instance in the current scene not the original scene because as it seems it will move the things around and store them persistently??!?
- there should be a way to stop process from going into code when in editor mode. try this.
# 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()
Godot - game development for homies
Status | Released |
Author | Bastian |
Genre | Educational |
Tags | Godot |
More posts
- loading resources with gdscript4 days ago
- i was wrong!7 days ago
- physics collision and layers7 days ago
- storing player position8 days ago
- component campfire8 days ago
- how to control things in a scene component8 days ago
- camera 2D9 days ago
- component : fadein10 days ago
- blocking my view eh?10 days ago