hi, i am new to gdevelop. Why did my character climb so far away from the ladder?
and upon contact with the bottom ladder, it tends to push my characters away only by jumping over it I am able to use the ladder but another issue occurs as the picture.
Check you collision box on the character sprite. Edit the sprite, and click on the Edit Collision Mask button. The red box on the sprite image is the hit box. If there’s a lot of blank space around the character, then either consider trimming the image (in an art package), or creating a custom hit box.
oh i just realize since it a new movement I need to resize it again, thanks
the issue is still there when i touch the ladder from the left side and no issue if i touch it from the right side
What does the collision boxes look like, for both the character and the ladder?
Are you using platform and platformer character behaviours on the respective objects?
And is the player collision box the same for all the animation’s frames?
platform ladder for the ladder, platform character for the knight and yes the collision box is the same for all animation frames
Could you turn on debugging and see what the hitboxes look like? It’s under Debugging Tools on the actions menu, “Other Actions” tab, and you should end up with an event that looks something like :
i have another question, i am working on another character rn, but why is that character glitch through the platform and walk on the platform underneath instead
Does the Player climb too?
And also, I suggest you not use this:
But instead check if Player is climbing and then change the animation
Yeah, I saw that other post. I’m not sure on that one straight off.
What are those purple boxes? They don’t seem to match up with anything in the scene.
And are the moving or idle sprites the same size as the climbing sprite? So including the transparent space around it?
ah that does fix the issue thanks, btw do you know how to make the player pick up the sword, for example when it touches the sword it will switch to the player design with the sword on it hands and will remain that way until the player find another sword
Maybe you can make a boolean variable called “is_holding_sword” and then check if Player is colliding with the sword, then change the is_holding_sword variable to True. If is_holding_sword variable is true, change the player’s design with the sword on its hands.
@user123, so your character now climbs up on the ladder rather than beside it?
If that’s so, then it’s got me bamboozled. I’ve created a sample project with the collision check and animation change (same as your original event), and it works fine. Which leads me to believe it’s something else that is causing the problem, and the fix only papers over it, so to speak.
Collision boxes have nothing to do with sprite positioning.
My bet is the origin and center points on that animation are not aligned with the other center/origin positions of the object.
At a high level: All sprites should be the same size, for every frame, for every animation.
This means that if you have some animations that are larger, all of your sprites will need to be set to that size.
Then you need to go into each animation and adjust the center/origin points to be correct, so that the origin point is close to the upper left corner of the character, and the center point is at the center of the character.
Any other combination than the above is going to be misaligned.
You can see this in the screenshot above of the ladder and the character. The Origin point is way to the upper left, way past where the character starts. and the Center point is no where near the character.
Edit: Just for an example, here’s the hero from the Not A Vania example at idle.
You can see that even though the sprite size is much larger with a bunch of empty space, the origin is roughly to the upper left of where the character is (ignoring the weapon), and the center is roughly in the center of the character.
Here’s a completely different animation, showing the points at the same positions:
Yes, this is what I was aiming at with my earlier questions.
@user123, I’m suspecting that when the animation changes from moving to climbing, it jumps to the right by a bit. And when it changes from climbing back to moving, it appears to jump to the left.
If so, the proper solution is to fix the sprites, as @Silver-Streak has mentioned. This may also fix your other issue you have, with the glitch through the platform.