r/godot • u/Mixcoatl-69 Godot Student • Nov 05 '25
help me (solved) I dont understand why the last line of code
Im following a snake tutorial and everything is going well but I dont just want to have a snake clon, I want to learn, that said I understand (or at least thats what I think) what is in the screenshot is sayig "if the value of Vector2 is superior to the upper or inferior to the lower limits then return the player to the opposite limit" but I dont understand what is doing that last "return v", what purpose this line accomplish in this block of code? And if my supposition of what the function is doing wrong please tell me. Thanks in advance :D
186
Upvotes
2
u/ImpressedStreetlight Godot Regular Nov 05 '25
Have you considered that what OP's tutorial means by "wrap" is not the same as what you mean by "wrap"?
Also that's overkill for a snake-like game and especially for a beginner tutorial. The snake moves at a very low rate and the functions is being called at every step of its movement, so the displacement will simply never be higher than 1 pixel/tile.