procedure Generation_Images

Zpět
procedure TAnt_Hill.Generation_Images ;  //  procedura pro pocatecni vygenerovani obrazku
var i,j, px,py,pom : integer;
begin
 for i:=0 to 24 do
   for j:=0 to 19 do
     Data_Images[i,j] := 0;
 px := curr_pos_ant_hill_x div 32 ;
 py := curr_pos_ant_hill_y div 32 ;
 for i:=px-3 to px+3 do
   for j:=py-3 to py+3 do
      begin
       Data_Images[i,j] := 1;
      end;
  Do_Ant_Hill(curr_size_ant_hill,curr_num_woods_hill-1);
 for i:=1 to NUMBER_GRASS do
   begin
    repeat
    randomize;
     px := random(23)+1;
     py := random(18)+1;
     pom:=Data_Images[px,py]
    until pom=0  ;
    Data_Images[px,py]:=2;
    Data_Grass[i].x:=px*32;
    Data_Grass[i].y:=py*32;
   end;
 for i:=1 to NUMBER_STONE do
   begin
    repeat
    randomize;
     px := random(23)+1;
     py := random(18)+1;
     pom:=Data_Images[px,py]
    until pom=0  ;
    Data_Images[px,py]:=3;
    Data_Stone[i].x:=px*32;
    Data_Stone[i].y:=py*32;
   end;
   // studna
    repeat
    randomize;
     px := random(15)+5;
     py := random(10)+5;
     pom:=Data_Images[px,py]
    until pom=0  ;
     Data_Images[px,py]:=3;
     position_well_x := px*32;
     position_well_y := py*32;

 for i:=0 to curr_num_woods-1 do
   begin
   repeat
    randomize;
     px := random(750)+20;
     py := random(550)+20;
    until ((px<(curr_pos_ant_hill_x-(curr_size_ant_hill div 2))) 
	           or (px>(curr_pos_ant_hill_x+(curr_size_ant_hill div 2)))) and
          ((py<(curr_pos_ant_hill_y-(curr_size_ant_hill div 2))) 
		       or (py>(curr_pos_ant_hill_y+(curr_size_ant_hill div 2)))) and
          ((px<=position_well_x) or (px>(position_well_x+32))) and
          ((py<=position_well_y) or (py>(position_well_y+32))) ;

    Data_Wood[i].x:=px;
    Data_Wood[i].y:=py;
    Data_Wood[i].where:=2; // vetvicka je na plose
   end;

 for i:=0 to curr_num_eggs-1 do
   begin
    repeat
    randomize;
     px := random(23)+1;
     py := random(18)+1;
     pom:=Data_Images[px,py]
    until pom=0  ;
    Data_Images[px,py]:=2;
    Data_Egg[i].x:=px*32;
    Data_Egg[i].y:=py*32;
    Data_Egg[i].where:=2; // vetvicka je na plose
   end;

  add_wood_howmany:=random(5)+1;
  add_wood_number:=random(100)+50;
  add_wood_counter:=0;
end;