This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

My primary game scene contains several instanced enemies placed on the scene (not programmatically). These enemies have an Area2D child which is used detect when the player comes close enough to them to follow and attack.

This worked perfectly fine with the original way I was changing scenes:

var main = main_scene.instance()

I wanted to get a little more control over my scenes and recently changed this code:

var main = main_scene.instance()

The level and enemies appear like normal, but the instanced enemies have stopped following and attacking the player.

Is there some sort of additional set up I need to do to ensure the main scene's children continue to function?

in Engine by (20 points)

Hi ,
Do you have a scene for the enemies and the new level inherited these nodes ?
Check the parameters are the same , if you have the code somewhere share do we can have a look ( layers and masks)
Good luck

Hi Jorge,
I have a few different separate scenes that extend each other for the characters. For example, and both extend a basic to add unique abilities to these enemy types. contains the universal functions and child nodes, such as an Area2Ds for player detection, an Area2D for hit collision, etc.

The main game scene is a collection of other instanced scenes inherited from other files, such as level.tscn, gui.tscn, and several enemies from zombie.tscn and mummy.tscn. The player's character is being added programmatically, since I plan to allow multiple different character classes.

The player is still able to interact with the enemy mobs, hitting and killing them off enemies. It's just the enemies themselves do not act on their own anymore (chasing players or attacking when the player is near) after changing the scenes transition from the lobby the the main game scene.

I don't think this should be a layer or mask configuration issue, as I can switch the scene transition back to get_tree().change_scene_to(main) and all of my enemies start chasing the player and attacking them again.

Please log in or register to answer this question.

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.