Cutting out smaller rectangles from a larger rectangle
Posted
by
Mauro Destro
on Game Development
See other posts from Game Development
or by Mauro Destro
Published on 2012-03-29T06:44:40Z
Indexed on
2012/03/29
17:43 UTC
Read the original article
Hit count: 268
xna-4.0
The world is initially a rectangle. The player can move on the world border and then "cut" the world via orthogonal paths (not oblique). When the player reaches the border again I have a list of path segments they just made.
I'm trying to calculate and compare the two areas created by the path cut and select the smaller one to remove it from world.
After the first iteration, the world is no longer a rectangle and player must move on border of this new shape.
How can I do this? Is it possible to have a non rectangular path? How can I move the player character only on path?
EDIT
Here you see an example of what I'm trying to achieve:
Initial screen layout.
Character moves inside the world and than reaches the border again.
Segment of the border present in the smaller area is deleted and last path becomes part of the world border.
Character moves again inside the world.
Segments of border present in the smaller area are deleted etc.
© Game Development or respective owner