Closed PaulB-H closed 7 months ago
Almost fixed...
Because there are no angled walls in phaser arcade by default (I think there is a plugin though) I created angled walls by using a line of ellipses. This is mostly working, however does not always cause a bounce back in the expected direction, and I still have issues with balls ghosting through them occasionally.
The cause of this issue has been related to how I actually draw each item in the collision group, not using the correct dimensions, getting the tile object / collision object confused.
Fixed with 25be1ba76cc49121effe452311461604aa2232d1
Walls are now a pixel-perfect match with Tiled
Seemed fixed, but only when placements line up nicely with the 16x16 grid in phaser, when they dont, things had weird gaps
I got the position of custom collision objects fixed, and then noticed blocks were not placed quite correctly..
Without light2d pipeline:
With light2d plugin:
We can see the red overflow is where the square SHOULD be, and where it thinks it is...
But after enabling the ligh2d plugin I have not been able to stop them from shifting right and down 1 px...
As long as the tile is within its normal 16x16grid position, it doesn't get messed up...
If I try and move it 1px out of that, the bug happens as we can see with the right side in the example below
Another discovery...
This is only happening to 16x16 blocks when they are placed at an odd offset from the grid in tiled...
Here we have no offset, our 16x16 tile lines up with the 16x16 grid in tiled, and it renders fine in game:
In game we see no overflow of the debug object anywhere, we know the tile is placed correctly:
Now, if we move everything ONE pixel up and ONE right:
We can see in game overflow from the debug object, our tile placement is not correct:
But now, if we move it one more pixel up and right, so its 2 px off grid:
It renders in game without any overflow again:
We can see this repeat at 4, 8, px off center all rendering fine, with odd numbers creating incorrect placement.
BUT when we turn off the Light2D pipeline, we can place tiles off grid and they render just fine:
Opened an issue in phaser related to this.
https://github.com/phaserjs/phaser/issues/6698
Closing as I don't need to fix it for this project.
These are actually made with a bunch of circles, since arcade physics doesn't support slopes.
It only worked out so-so, and can still cause very unexpected rebounds.
This issue might have been caused by my attempts to make a double width wall since 1px walls seems to let balls through occasionally