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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /** * 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); } |