I can’t figure a proper way to achieve my goal and I’d really appreciate some help.
I want my player to move only :
on one axis at a time
along certain lines of a shape OR inside of this shape.
I’ll try to explain.
At first the player spawn on the border of the world, wich is a rectangle (the background = the shape).
When the player moves, he can move along the borders of the shape or he can move on x or y axis if he goes inside the shape.
When he moves , he draws a new line behind him. He can change direction, as he still remains inside the shape.
If he closes the line by returning to the border of the shape, the shape is then reduced by excluding the polygon that the player has drawn with his lines and the borders.
OK, obviously I’m not clear…
BUT, I have a perfect exemple of what I mean : Gal’s Panic
What I think I could do is to maintain an array of lines representing the borders of the shape.
And, in my player controller, I could test if the movement the player is trying to do is effectively going along at least on of these lines. But I think it’s a bit complex and I guess there’s better. Plus I don’t really know how to manage the movement inside the shape, the line closing or the way to resize the shape…
Does anyone would have some clues to help me going on the right way ?