ID:156397
 
Ok so Im working on a variation of a classic game called Jezzball (online version:Jezzball.net) What Im having trouble with is how to figure out how to tell if there is a ball inside a certain space and when a part of the screen gets fully closed how to fill in the space.
Have a separate /area for each region of space. When you successfully split a region, just create a new /area and add to it every turf whose x or y (depending on direction) is less than that of the split. You can then use locate() to find the ball in the area (it'll be in its contents).

Note: to create a new instance of an area, just do:

var/area/A = new()


Don't pass any arguments to new(), or you don't actually get a new instance of an area.
In response to Garthor
That works if it was an all or nothing type split, but the problem Im having is if one part of the line makes it and the other half doesnt it makes a partial wall, so it doesnt create a new area but affects it and then you can have odd shaped areas instead of just rectangles.

Note: Im making this for both DM and for Android devices so doesnt neccessarily need to be specific to DM code, can be more of an idea how to do go about figuring it out.
In response to NightJumper88
NightJumper88 wrote:
doesnt neccessarily need to be specific to DM

A simple google search for polygon bounding box returns concepts such trivial as this Microsoft article, reaching to better articles like an early draft of Haines, Eric, "Point in Polygon Strategies," Graphics Gems IV, ed. Paul Heckbert, Academic Press, p. 24-46, 1994.

That is, if I understood your question and you intended to check if a given point (the 'ball') is inside a polygon shape.

Edit:
Just figured you wanted a notion on filling polygons as well.
In response to Schnitzelnagler
Ok thanks for the links and they help a lot, now one thing im having trouble with is changing the shape of the polygon and adding in a vertex and figuring out where to add it in the list so that the shape isnt messed up since the vertices need to be in order