Perhaps it is just me but your solution and does not get all the grid locations. All this does is get the grid locations in a direct horizontal, vertical and 45 degree angle from the starter grid. Go out 2 or 3 levels and you quickly find that there are grid spots missing.
Charles P. On 6/17/07, Joshua Sera <[EMAIL PROTECTED]> wrote:
The easy way to do this is like so. So you have a square at x,y, and you want to get all the squares n squares away. Get squares x+n, y x-n, y x+n, y+n x-n, y+n x+n, y-n x-n, y-n x, y+n x, y-n I suspect you want to do this for your version of that whale-ey thing though, so what you actually want to do is a bit different. First off, to find out which grid square a point fits into (this being the center of where your user is looking): You need the height and width of your grid squares. Take your point (x, y) Your point fits into grid square [Math.floor(x/squareWidth), Math.floor(y/squareHeight)] Apply this by figuring out where on the big picture your person is looking. After that, move left and up by half the screen width, and height, then right and down by the same amount, and you have the ranges of squares to get in order to display that part of the image. --- "Jiri Heitlager | dadata.org" <[EMAIL PROTECTED]> wrote: > Please I really need help on this on, I am cracking > my head over it. > Bresenham algo is also not the way to go, because it > is for circle's and > to complex! > I can only get one ring, arggggggg!!!! > > If I go one ring further then it results in many > double values, > calculate allready when doing the first ring. > > Here is the code.. > > var row = 0; > var c:Number = 3; > var ring:Number = 1; > //take start pos [2,2] > var x:Number = 2; > var y:Number = 2; > // > while (row<c) { > for (var i:Number = 0; i<c; i++) { > var rowID:Number = (x-ring)+i; > var colID:Number = (y-ring)+row; > if (rowID<0 || colID<0 /* || (rowID == sR > && colID == sC)*/) { > continue; > } > trace('['+colID+','+rowID+']'); > } > row++; > } > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the > archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___________________________________________________________________________________ You snooze, you lose. Get messages ASAP with AutoCheck in the all-new Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_html.html _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com