System: Windows XP, P4 2 GHz
Compiler/IDE: Delphi 7 for Win32
API: Gl Scene
-----
I've been playing round with some ideas for a game concept for a couple of years now and I've started to try again, last attempt was Games Factory! You might have seen my other posts in Help Me!
Thing thing I'm stuck on now is trying to finalize my level off. I now have a array which has a number of random numbers which increase inwards...sort of simulating a city of sorts. The problem I have now is to calculate the coordinates of each corner and the size to pass to GLScene for the final objects.
The solution was to just create a simple procedure and a record structure to hold all the coordinates and sizes of numbers...But it doesn't seem to work!
----------
procedure finalworld ;
var
tempmaxy : integer;
ac,bc,maxyf:integer;
previousrec:integer;
begin
bc:=1;
maxyf:=1;
maxy:=1;
for l1:=1 to sizea do // y
begin
//prevous highest value
bc:=tempmaxy;
if bc>maxy then maxy:=bc; //if greater make the y coordinate of previous iteritation the new value + line no.
maxyf:=maxy+l1;
for l2:=1 to sizea do //x
begin
with map[l2,l1] do
begin
sizeof:=a[l2,l1];
recnumber:=previousrec;
tlx :=l2+ac;
tly :=maxyf ;
trx :=l2+ac+a[l2,l1];
tryi:=maxyf ;
blx :=l2+ac;
bly :=a[l2,l1]+maxyf ;
brx :=l2+ac+a[l2,l1];
bry :=a[l2,l1]+maxyf ;
floors:=round(a[l2,l1] div 10);
end;
previousrec:=previousrec+1;
ac:=a[l2,l1];//previous a values
if ac>=tempmaxy then tempmaxy:=ac ; //finds the highest value during iteration
end;
end;
______
All I'm trying to do is to find the greatest value during the x iterations per line, and then compare that to the y itertation to determine the y starting coordinate for the next line. If that makes sense.
The reason I didn't post this in help me is that I'm not desperate for help, just like ideas as I the only way I know of how to reference cells in arrays is 'for' loops from 1 to end. I can't seem to do any complex computations in them. How do you refer to cells when processing complex computions? Or how to calculate coordinates to work? Any ideas of how to go about this problem would be most appreciated!
Thanks
Whitt
Bookmarks