GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Add warning when editing the collision mask of a platformer object

Open AlexandreSi opened this issue 4 years ago • 11 comments

Closes #3312

https://user-images.githubusercontent.com/32449369/145590989-eaa6fe57-2794-4779-a161-9ee9d3165410.mp4

AlexandreSi avatar Dec 10 '21 14:12 AlexandreSi

The warning message does not really warn with reason.

You currently use a custom collision mask for an object that has the Platformer behavior. Yes ok, what is the point to explain me me something I do? If this action I made has consequences on something else it must be describe.

Because for me the second part explain something else: To prevent issues when flipping an object horizontally while grabbing an edge, make sure your collision mask does not move when flipping it.

This last sentence have no relation with the first sentence, it describe something else. If the implicit explaination is that the collision mask isn't supported by platformer behavior, it's not describe in these sentences, that is the point that should be explain in the first sentence IMO.

Bouh avatar Dec 10 '21 15:12 Bouh

I say that because I had read this issue just before https://github.com/4ian/GDevelop/issues/3344

Bouh avatar Dec 10 '21 15:12 Bouh

As I commented in #3344, I think that there are 2 problems that could require 2 warnings:

  • If you define a custom collision mask that is not a single rectangle, prepare for surprises (and we could add checks on the collision mask to display this warning only if it is not a single rectangle)
  • If you define a custom collision mask, make sure it does not move when flipping it horizontally because when grabbing edges, it could do funny things (but if you didn't activate the edge grabbing, you can ignore that).

AlexandreSi avatar Dec 10 '21 15:12 AlexandreSi

You currently use a custom collision mask for an object that has the Platformer behavior. Yes ok, what is the point to explain me me something I do? If this action I made has consequences on something else it must be describe.

I guess I wanted to make sure that the user understands why this warning appears. That way, he can easily find a workaround for what he is doing or refer to that in the forum.

Because for me the second part explain something else: To prevent issues when flipping an object horizontally while grabbing an edge, make sure your collision mask does not move when flipping it.

This last sentence have no relation with the first sentence, it describe something else. If the implicit explaination is that the collision mask isn't supported by platformer behavior, it's not describe in these sentences, that is the point that should be explain in the first sentence IMO.

What do you think of: "You currently use a custom collision mask for an object that has the Platformer behavior . A platformer with a custom collision mask could experiment issues if it is flipped horizontally while grabbing an edge. To avoid that, make sure your collision mask does not move when flipping it."

AlexandreSi avatar Dec 10 '21 15:12 AlexandreSi

What do you think of: "You currently use a custom collision mask for an object that has the Platformer behavior . A platformer with a custom collision mask could experiment issues if it is flipped horizontally while grabbing an edge. To avoid that, make sure your collision mask does not move when flipping it."

It's definitely better :)

Bouh avatar Dec 10 '21 15:12 Bouh

People may not know what causes a collision mask to "move".

"If the collision masks are not centered vertically, the object may act erratically when the flip action is performed near a wall."

tristanbob avatar Dec 10 '21 16:12 tristanbob

People may not know what causes a collision mask to "move".

"If the collision masks are not centered vertically, the object may act erratically when the flip action is performed near a wall."

That's where I am always confused what is vertically center vs horizontally center 😅.

New proposal: You currently use a custom collision mask for an object that has the Platformer behavior. A platformer with a custom collision mask could experiment issues if it is flipped horizontally near a wall. To avoid that, make sure your collision mask does not move when flipping it by centering it.

AlexandreSi avatar Dec 10 '21 16:12 AlexandreSi

You are right, I should have said "centered horizontally".

You currently use a custom collision mask for an object that has the Platformer behavior. A platformer with a custom collision mask could experiment issues if it is flipped horizontally near a wall. To avoid that, make sure your collision mask does not move when flipping it by centering it.

This looks fine, but it has a small typo: experiment => experience

tristanbob avatar Dec 10 '21 16:12 tristanbob

Thanks for the catch!

AlexandreSi avatar Dec 10 '21 16:12 AlexandreSi

You currently use a custom collision mask for an object that has the Platformer behavior. A platformer with a custom collision mask could experiment issues if it is flipped horizontally near a wall. To avoid that, make sure your collision mask does not move when flipping it by centering it.

Simply centering the hitbox will prevent the bug but can be misleading and users might understand it as center horizontally and vertically and afaik that's not all required. Furthermore, I have a feeling that this warning is getting a little too long and I can see users (including me if I didn't know what could happen) being confused and having to read that phrase multiple times to understand what causes the error/"bug".

I see the first sentence as completely redundant because it's not saying anything the following sentences aren't mentioning and also "You currently use a custom collision mask" doesn't cause the bug.

Also, I can imagine that only "Platformer" behavior could be misinterpreted by users.

~~I've never heard "experiment" in that context before. Was it meant to be "experience" or is that a correct sentence?~~ Sorry, Tristan had already mentioned that

"Move" is unclear when describing the collision mask. In this context, "move" could even be unclear in definition. If I flip a square, doesn't the top right point of the collision mask not move to the left side (instantly)?

If GDevelop could check the hitbox points, I think we need to only show that warning if it's not centered horizontally (if possible).


Proposal: "Your Platformer Character object has a custom collision mask that is not centered on the X-axis. This can cause issues when flipping the object horizontally near a wall."

Elairyx7301 avatar Dec 10 '21 17:12 Elairyx7301

I hear you In this case, I think we can do something more complex that would benefit #3344 as well. I'll work on it next week.

AlexandreSi avatar Dec 10 '21 17:12 AlexandreSi

Not relevant anymore

AlexandreSi avatar Apr 29 '25 11:04 AlexandreSi