Using the adorner on floor/ceiling screens
The automatic YOffset
calculations fail if your screens are not perfectly flat vertically. If you have screens on the floor, on the ceiling, or anywhere that isn't a perfectly flat 90 degree wall, then you should add a YOffset
attribute yourself. The value of it is calculated the exact same way the XOffset
is calculated, but going from the top instead of from the left.
You still have to include a TopMarker
part in your game, even if you calculate the YOffset
manually.
Example
We will use the example game from the previous pages and manually add YOffsets
to the screens. Let's rotate them so they're on the ground.
Let's add a YOffset
property to all of our screens, the same way we did with the XOffset
.
The first screen is at the highest point of them all, which means it's at the top of our 2D canvas. This means that it doesn't need an offset and the YOffset
can be left at 0.
The second screen is placed 4 studs below the top line, so its YOffset
should be 4
studs × 50
pixels per stud = 200
pixels.
The third screen is slightly higher up, only 2.5 studs below the top line. 2.5 × 50
= 125
, so the third screen's YOffset
is 125.