plik h
class Pole
{
private:
static int Mapa_Tla[12][12];
void Pole::Przejscia(TImage* Owner, int ktory_x, int ktory_y, int tlo);
}
plik cpp
void Pole::Przejscia(TImage* Owner, int ktory_x, int ktory_y, int tlo)
{
if (Mapa_Tla[ktory_x+1][ktory_y]!=Mapa_Tla[ktory_x][ktory_y])
{ if (Mapa_Tla[ktory_x+1][ktory_y]==0)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[Pole->Width-x][random(Pole->Width)]=clGreen;
} } }
else if (Mapa_Tla[ktory_x+1][ktory_y]==1)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[Pole->Width-x][random(Pole->Width)]=clYellow;
} } } }
if (Mapa_Tla[ktory_x-1][ktory_y]!=Mapa_Tla[ktory_x][ktory_y])
{ if (Mapa_Tla[ktory_x-1][ktory_y]==0)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[x-1][random(Pole->Width)]=clGreen;
} } }
else if (Mapa_Tla[ktory_x-1][ktory_y]==1)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[x-1][random(Pole->Width)]=clYellow;
} } } }
if (Mapa_Tla[ktory_x][ktory_y-1]!=Mapa_Tla[ktory_x][ktory_y])
{ if (Mapa_Tla[ktory_x][ktory_y-1]==0)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[random(Pole->Width)][x-1]=clGreen;
} } }
else if (Mapa_Tla[ktory_x][ktory_y-1]==1)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[random(Pole->Width)][x-1]=clYellow;
} } } }
if (Mapa_Tla[ktory_x][ktory_y+1]!=Mapa_Tla[ktory_x][ktory_y])
{ if (Mapa_Tla[ktory_x][ktory_y+1]==0)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[random(Pole->Width)][Pole->Height-x]=clGreen;
} } }
else if (Mapa_Tla[ktory_x][ktory_y+1]==1)
{ for(int x=1; x<10; x++)
{ for( int y=0; y<50/x; y++)
{ Pole->Canvas->Pixels[random(Pole->Width)][Pole->Height-x]=clYellow;
} } } } }