Tutorial and global vs. local position #10636
ffslight
started this conversation in
General Discussions
Replies: 2 comments 1 reply
This comment has been hidden.
This comment has been hidden.
-
But suggestion something like: mob.Position = mobSpawnLocation.GlobalPosition; In this tutorial sends a very wrong message to new users, if anything it should be: mob.GlobalPosition = mobSpawnLocation.GlobalPosition; But regardless if the tutorial is followed correctly then the code works, and IMO we shouldn't introduce concepts that are beyond the scope of a tutorial like this, it makes things harder for beginners It would also hide errors from beginners, which would be a negative, instead we might want to add a note to remind people if they mess up to check their hierarchy |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I followed the tutorial at this step:
https://docs.godotengine.org/en/stable/getting_started/first_2d_game/05.the_main_game_scene.html#spawning-mobs
I recognize that i can have missed a step, but i was curious how the MobPath worked, so i tried to spawn entities without giving them any velocity, expecting them to form a rectangular pattern(follow the shape of my MobPath).
However they did not. And i dont even see them spawning on screen.
I then investigated and found that if i change their spawn location to use GlobalPosition:
mob.Position = mobSpawnLocation.GlobalPosition;
it would work as intended.
Because of this i figured it was an error in the tutorial and i submitted a pull request, to change it to global position, but it was rejected as the code works as intended. And i was suggested to start a discussion instead.
For reference this is my path:


and the mobspawnlocation:
Mobs are set to 0,0 in local space.
Here is an image side by side, with how the(in this case a placeholder) spawns randomly following the path using Globalposition as i suggest:

So assuming i am doing something wrong since i can only make it work with GlobalPosition, what might that be?
Be aware that yes, the tutorial code "works", meaning that the game does as intended and spawns enemies randomly crossing the screen.
Beta Was this translation helpful? Give feedback.
All reactions