Should I double code or use scene instancing

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jujumumu

I am making 2 worlds for a game. I could either use scene instancing to instance the player in the two scenes but that would be complicated because the two worlds have different variables so I would have to use a different script to the edit the player. I could also just make the player in each screen and just change the player easily. Which one should I do?

:bust_in_silhouette: Reply From: Eric Ellingson

You should definitely have a separate scene for the player, which is instanced in each level/world. It isn’t unreasonable for each world to have its own script, which should be used to initialize values for your player and other nodes/scenes.

You want to have all of your player code in one place, so that if you want to change something related to the player that should be changed in all worlds, you only have to do it in one place.

I tried this and it worked very well. Thank you.

jujumumu | 2019-07-29 02:57