Godot 4.2.1
I can’t get my npc to repsond like it should please help also it spawns in two differents places if anyone sees why please let me know
Godot 4.2.1
I can’t get my npc to repsond like it should please help also it spawns in two differents places if anyone sees why please let me know
Can you explain the problem?
like i said it won’t respawn and it appears at the top and bottom of the screen
You mean that it respawned at wrong position? Then which position do you want for it?
Or it even does not respawn?
it spawns at the bottom and top of screen its only supposed to spawn at the botttom and once hit doesn’t respawn like it should
This is because you does not set its position to the bottom.
ncp_instance.position = position
Change this above codes to:
ncp_instance.position = Vector2(25, 1000)
Replace the 1000 with the bottom position you want.
thanks but what about the issue of not respawning
Do you started the timer? And is it connected properly?
as far as i can tell yes i’ve been working on this for 4 hours and may be a bit tired so i may have missed something did you check the pics they have all the stuff related to my problem
Before you queue_free the ncp, add this code:
get_parent().respawn_ncp()
Rename the function _on_timer_timeout with respawn_ncp in the main window script.
Then in that function, do like this:
await get_tree().create_timer(1.0).timeout
can_spawn = true
Delete the spawn timer from ncp, we not need it.
If it does not works, show a screenshot of your codes.
i did what you said i got this error
Invalid call. Nonexistent function ‘respawn_npc’ in base ‘Window’.
Where do you called that respawn_ncp function?
I used get_parent for getting the main game window node where you should call that function.
Can you show a screenshot?
Can you show the main game window script?
This is because it actually shows an error in that script, can you tell that error?
that is just because i typed a letter when taking the screenshot its not the problem
Hmm, so what do you think, why its happening? Any idea?
Try to replace the get_parent()
with get_tree().current_scene
k now there is no error but it doesn’t repawn either
btw I would like to thank you for taking the time to help me it means a lot