Here’s a question about the hit box.
When working on a small graphic, it is very uncomfortable to be unable to enlarge the screen.
If I use the custom hit box, the character can’t keep still
I attach a picture.
I only have 3 files attached.
In the picture, it’s a hit box setting for an object in the floor tiles.
If I touch the hit box a little bit, you won’t be able to stay still.
I don’t know why, but if I hit the wall, it won’t stop.
I think it has something to do with Origin. What does Origin do?
The files are attached in reverse order.
There’s a size limitation, so I can’t upload the rest of the files.
The motion from the attached file is:
Motion that is replayed as a condition of ‘when the character falls’.
It’s because each animation set a different hit box, but I used only one sprite for the landing motion.
Is that moved away when the motion idle
This was the default setting before using the custom hit box of the floor of the project.
And even though I put a custom hit box into the player sprite, the sprite is in the air about a pixel.
Easy: create an invisible object (let’s call it char_hitbox) and set the platformer behavior to it, then attach the character sprite to the char_hitbox.
Use the char_hitbox to set the platformer behavior. but do other collisions with the custom hitboxes of the animated sprite.
Note: origin is the point (pair of coordinates) from where the object is drawn. You can see it like a pin, the sprite is pinned to the scene from that point. By default it’s at the top-left corner. Most of the time I set the origin point of platformer objects centered at the bottom.
Seems like a problem with multiple hitbox sizes. I guess the stand hitbox and the hitbox when falling have different sizes. On falling it detects a collision with the floor, so it switches to the stand animation, but the size is smaller and you’re on the air again, forever. I think there’s another thing in the background since if you’re on the floor and the character size changes it should stick the character in the floor moving it down
EDIT: The same than the preview reply, but written the long way.
Check the platformer template, it uses a secondary object as the hitbox, the red rectangle is the real platformer, the player sprite is just an image sticked on the hitbox object. Again, the platformer is the red rectangle and has constant size, so problems like yours doesn’t appear.
Maaaaaybe you can fix it through the Origin point, in the falling animation locate it so the distance from the Origin to the base/floor is the same than the standing animation.
For example, if the stand animation height is = 100 and the falling animation height is 105, you should place the falling animation Origin at Y = 5.
Anyway, don’t know if it will work as there’s a size change anyway
I have already set the origin value according to the size of the sprite
No problem occurs when floor objects use default hit boxes
However, problems occur only when using the custom hit box
I’ve combined and tested all the animated hit boxes, but it’s the same result.
As you say, I need two objects.
Objects showing the Player character sprites
Fixed-sized sprites that actually function as flatformers
Is it right?
It’s like using another sprite to set up a conflict check mask in a game maker.
Like Lizard told you, check the platformer example.
Ehrmmm, yesss… guessing we’re imagining the same thing…
… you get the idea!
Oops, I didn’t see examples because I made them out of Gdevelop5 wiki’s tutorials.
The example shows that the player hit box object is built separately.
Thanks to you, I solved the problem!
When I move across the wall, the character shakes, but I don’t know why.
Yeah, that’s a little problem with GD, after you have finished your events GD does an extra step to fix the platformer position not sure why, it may end up in a little offset/shake, you can open an issue on GitHub, maybe you’ve luck. Sadly I can’t take a look at this one.
I also can not see the Github because it’s difficult.
I’m sure you can, just put more effort on it. Tip: wide open your eyes in front of your computer screen when the Github page is loaded and you’ll see it. It’s not so difficult.
Note: examples are bundled with the GD installation.
There is already an open issue about this on Github, unfortunately not yet resolved: