Imagine the following scenario: I have a level whose physical structure is built from a collection of bounding rectangles, combined with a preliminary raster background. My actors, including the player’s character, have their own bounding box. If the actor manages to get stuck inside the level block, partially or otherwise, he will need to be moved again so that he is on the same level with the block.
The unverified technique that I came up with during the biodegradation is as follows:
If you find that the exponent field intersects the level field, determine where the center points of each rectangle are. If the actor’s center is higher than the level field, move the actor so that the lower part of the rect actor is flush with the upper part of the rect level, and vice versa if it is lower. Then do a similar thing horizontally.
Opinions on this? Suggestions for best practices?
In fact, bounding boxes are XNA BoundingBoxes with their Z-range from -1 to 1, but this is still a 2D gameplay.
source
share