i got this code from Scenarios on this website but i dont understand why got so many constructor that differ in length between parameters and its content
/**
* First 2 collumns: Width and Height of the whole World
* 3rd & 4th collumns: Width and Height of the Screen, that should be shown
* 5th collumn: CellSize
* The Position on the left uppon corner is 0,0
* Background Moves,too
*/
public Scrollworld(int Width, int Height,int ScreenWidth,int ScreenHeight,int CellSize)
{
this(Width,Height,ScreenWidth,ScreenHeight,0,0,CellSize,true);
}
/**
* First 2 collumns: Width and Height of the whole World
* 3rd & 4th collumns: Width and Height of the Screen, that should be shown
* 5th & 6th collumns: The Position on the left uppon corner
* 7th collumn: CellSize
* Background Moves,too;
*/
public Scrollworld(int Width, int Height,int ScreenWidth,int ScreenHeight,int CellSize,boolean BackgroundMove)
{
this(Width,Height,ScreenWidth,ScreenHeight,0,0,CellSize,BackgroundMove);
}
/**
* First 2 collumns: Width and Height of the whole World
* 3rd & 4th collumns: Width and Height of the Screen, that should be shown
* 5th & 6th collumns: The Position on the left uppon corner
* 7th collumn: CellSize
* Background Moves,too;
*/
public Scrollworld(int Width, int Height,int ScreenWidth,int ScreenHeight,int ScreenLeft,int ScreenUp,int CellSize)
{
this(Width,Height,ScreenWidth,ScreenHeight,ScreenLeft,ScreenUp,CellSize,true);
}
/**
* First 2 collumns: Width and Height of the whole World
* 3rd & 4th collumns: Width and Height of the Screen, that should be shown
* 5th & 6th collumns: The Position on the left uppon corner
* 7th collumn: CellSize
* 8th collumn: should the background move, too
*/
public Scrollworld(int Width, int Height,int ScreenWidth, int ScreenHeight,int ScreenLeft,int ScreenUp, int CellSize, boolean BackgroundMove)
{
super(ScreenWidth, ScreenHeight, CellSize, false);
if(ScreenWidth>Width)
ScreenWidth=Width;
if(ScreenHeight>Height)
ScreenWidth=Height;
this.Width=Width;
this.Height=Height;
this.BackgroundMove=BackgroundMove;
this.CellSize=CellSize;
if(BackgroundMove)
{
Background=new GreenfootImage(Width,Height);
Background.setColor(Color.white);
Background.fillRect(0,0,Width,Height);
}
ShowWorld(ScreenLeft, ScreenUp);
}
