Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Vladislav Vorobiev | |
Old Version | Published before Godot 3 was released. |
I have 2D sidescroller with room-like level transitioning. When I move my character to some kind of door, I can press a button to teleport to next level. And this is the moment where stuff getting weird.
After I change level, I’m not destroying my player instance, but trying to change player position to another room door position in new level using set_global_pos
. For some positions it’s working without any hassle, but certain positions not work: player pos is about ~100 pixels higher than expected…
I have tried to debug this stuff: at the start of _fixed_process()
func I get position that I expect([0, 87] in my case), but after calling move(velocity * delta)
stuff gets super weird: this func applies some small velocity (like [0, 8.33]), and position becomes [0, 12]! Next fixed process iterations player moves higher and higher until like its ~100 pixels higher as I mentioned above. I just can’t understand this
Update code for my character is same as in the bottom of Godot KinematicBody article: http://docs.godotengine.org/en/latest/tutorials/2d/kinematic_character_2d.html#moving-the-kinematic-character
Please help me, I already have ragequited like 10 times or so, I just can’t fight this crap anymore.
This screen may help you:
That “door” on the screen has Area2D with CollisionShape2D of Rectangle. It is in different layer than player, so no collision should happen.