Topic was automatically imported from the old Question2Answer platform.
Asked By
hommixo
Hello, I’m new to Godot. I’m trying to make a game where the player is constantly moving on a ground and scaling down (But not exceeding 0.1 in scale) and if you click, the player scales up. The problem is when the player is scaling down/up he doesn’t stick to the ground he just sort of floats because he’s scaling according to his center point. Here is the code I’m using:
You just need to simultanously move him down by scale amount of height, and back up.
Or just apply gravity and floor collision so it will happen naturally
Here you can move the sprite and the collision shape up by spriteHeight/2. This way your Area2D.position is located in the bottom/center of your sprite and collision shape, and the scalling is happing towards this point.
You can set the position manuelle in die sprite and the collision shape or by script in the _ready function, like