Re: map = repeat(repeat(....
I think it should actually turn out like this:
map = repeat(repeat(repeat(repeat({0, 0, 0}, -- x-y position and flag
8), -- 8 columns of the sector
8), -- 8 rows of 8 columns of the sector
8), -- 8 sectors in a row (columns) to one grid position
8) -- 8 rows of 8 sectors to form grid
-- Reference a point by:
map[grid_row][grid_column][sector_row][sector_column][(x, y, or flag)]
Eg:
map[4][6][2][5][1] = 3 -- x-coordinate of sector at pos (2, 5) of grid
at pos. (4, 6)
I hope that didn't confuse you. (or me!)
Try looking at the Language War demo that comes wth Euphoria.
>From: timelord at zebra.net
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: map = repeat(repeat(....
>Date: Sun, 13 Jan 2002 17:23:50 -0600
>
>
>I am working on a trek game that uses 8x8 sector grids, and an 8x8 quadrant
>grid.
>I would like to make a sequence called map to contain all the info for the
>quadrant
>and all the sectors inside each quadrant.
>
>Information for each quadrant will consist of it's x-y position and a flag
>stating
>if that quadrant has been explored yet. (0 = NO, 1 = YES)
>Each sector will consist of an 8x8 grid and what type of object (if any) is
>in
>each x-y location...
>
>----------------------------------/ here's what I'm at so far
>
>constant quadX = 1, quadY = 2, explored = 3,
> sectorX = 4, sectorY = 5, object = 6,
> fedship = 1, klingship = 2, starbase = 3,
> base = 4
>
>sequence map
>
>map = repeat(repeat({0,0,0}, --/ makes an 8x8 quadrant map
> (repeat(repeat({0,0,0}, --/ makes an 8x8 sector map in each quadrant
>map
> 8),8),8)),8) --/ It don't work. I rewrite it and keep
>getting
> --/ the same error message
>
>ex. - map[3][4][1][7][6][object] = fedship
>in quadrant 3,4-sector 7,6 the object is the players ship,
>when the ship moves out of sector 7,6 and up to sector 3,6 then
>
> map[3][4][1][7][6][object] = 0
> and
> map[3][4][1][3][6][object] = 1
>
>---------------------------------/
>
>Well that's about what I'v been working on for this weekend. . .
>Anybody got any suggestions how to make it work???
>
>thanks...
> >"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'
>
>
>
>
|
Not Categorized, Please Help
|
|