The last of three 2D feature proposal to make Godot 3 even more friendly for beginners.
Today I read a comment from a great youtube creator (HeartBeast) of Gamemaker 2 and Godot 3 content. It's about what features that he wish were implemented into Godot 3. Gonna create one post per feature request (there are three).
The feature proposal is "Maybe some default arguments for instancing scenes. So, like default add the new scene as a child to the parent and set its global position to the same as the parent. If people want these to be different allow them to pass the information into the instance() function. Or maybe have a new instance function for beginners that has less control but covers the default use case (similar to instance_create in GameMaker)".
His channel is https://www.youtube.com/user/uheartbeast/videos
Thank you.
I don't think this is a good idea. A new instance is a new instance - I don't think it's a good idea to be making assumptions on the user's behalf about what they want to do with it.
a new instance function for beginners that has less control but covers the default use case
I definitely don't like this one. I don't even think it's true that adding a new instance as a child of the current node even is the "default" use case. Even if it were, I can see this introducing more confusion, as now there are two quite different ways to do the same thing.
Being beginner-friendly is a good thing - a thing I think Godot already does well, which is why I started using it in the classroom. However, there's a difference between being beginner-friendly and being beginner-focused. I don't think it's in Godot's design to be the latter.
The (maybe not) obvious question is: which arguments should instance() take? If you add a lot, then it's cumbersome to set and hard to understand, if you add a few then it's not flexible enough for use cases.
IMO since you're already instancing by code anyway, just add a few more lines to adjust the instance to your liking. There's no need to pass arguments to instance() call.
The less hidden assumptions it has, the better it is. You might find it easy to automatically do some stuff... until you get into a project where you don't want it to happen. Then you'll have to add hacky workarounds to solve your case. Flexibility is much better.
I do not like it but seems like instance([]) (doing something extra after init?) to avoid calling another function.
And many things may not work as people expect because most will want to use elements available only when the instance is in the tree (where signals can be used too for set up if needed).
Default arguments should be in the instanced scene... Not in the scene that instance other. If you need to set same position that parent, you do that in _ready() in the scene to instance. Bug tracking if better with independent objects. Pass arguments to scene is beggin the spagetti to early in the development. The spagetti came to us in some moment inevitably, we should not acelerate that, the night is dark an full of terrors...