Friday 27 January 2012

New screenshot

A screenshot from something I'm working on. Yes, it has circles in it.



And a tip, if you're developing on a Mac. Turn on Web Sharing (under Sharing in System Preferences), then set the path Flash builds the SWF and HTML to something like "../../Sites/xxx", where xxx is the file name of each. Then you can access it in the browser using the IP address of your machine and the HTML file name, as above. No need to upload it to a separate site for network testing. It's still a local file so will work locally in the debugger or standalone Flash player just fine.

Thursday 26 January 2012

Circle-line intersection

Yesterday's method for determining whether a circle crosses a line can also be used to find where the crossing points are. The approach uses the distance calculated in the hitLine function with some simple circle geometry.

Wednesday 25 January 2012

Circle-line incidence

Problems involving circles and lines can be straightforward, if handled the right way. The main reason for this is the fact that the distance from a circle to a line is just the distance from its centre to the line minus the radius. I.e. if a circle radius 100 touches a line the circle's centre must be 100 units from the line.

Tuesday 24 January 2012

More on circles


Yesterday I described circle-point and circle-circle intersection tests. These are very straightforward to do, and it is interesting to look at why this is so, as it can help solve other problems with circles.

Monday 23 January 2012

Circles

Circles are used for many things in 2D games. Not only for things that are inherently circular (wheels, balls) but for many effects and to describe many situations. For example the range of a gun is often a circle, or at least circular.