I was following a youtube tutorial and going trough the comment section and somebody pointed out an error that if you move diagonally the player moves much faster and that it can be fixed by instead of “input_direction * move_speed” to use “input_direction.normalized() * move_speed”. Did it and the player started dissapearing in game randomly until it was gone completly. I changed it back to how it orignaly was but the problem stayed.
Make sure to paste code with proper formatting instead of screen shots
Use Input.get_vector over constructing a Vector2, this is not only normalized for diagonal movement but allows for slower movement such as tilting a joystick half way.
var input_direction := Input.get_vector("left", "right", "up", "down")
I will thank you, I was trying to figure out how to properly post codes for a while now. I changend the code how you said and it fixed the player movement so thanks alot! The player still keeps dissapearing though at ceartain areas in the world and idk why , I thought it may be the tilemap but I doubt it.
Yes, but then the player would dissapear at random times, but the player specifically dissapears at certain areas on the map. I have no idea where this comes from but it was totally fine before I orignally tried to change the code in the beginning.
Sorry if it’s to short but it wont let me put in anything greater than 8mg. It’s also not just the player, the cow dissapears too if it walks into those areas.
Heres the scene tree of the scene and the player scene. The cow scene tree is basically the same as the player scene and the other scene is just the main menu.
Looks like z-sorting of tilemap. Check tiles where player disappear.
But if player still not appearing while moving up past that point, then maybe you decreasing its z-index somewhere in the code.
You have Y sort enabled on the root node, so the tilemap is placed above the player because it’s y value (at 0, 0) is above the player’s. I believe you only want Y Sort on the tile map layers.
Make sure to change your deprecated TileMap node type to a Node2D.