From FANG
|
01 packagepackage is used to name the directory or folder a class is in scg.ch02;
02
03 importimport means to make the classes and/or packages available in this program fang2.core.Game;
04 importimport means to make the classes and/or packages available in this program fang2.sprites.RectangleSprite;
05
06 // FANG Demonstration program: RectangleSprite
07 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects Square
08 extendsextends means to customize or extend the functionality of a class Game {open braces start code blocks and must be matched with a close brace
09 // Called before game loop: create named rectangle and add
10 @Override
11 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup() {open braces start code blocks and must be matched with a close brace
12 RectangleSprite rectangle =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor RectangleSprite(0.5, 0.5);
13 rectangle.setLocation(0.5, 0.5);
14 addSprite(rectangle);
15 }close braces end code blocks and must match an earlier open brace
16 }close braces end code blocks and must match an earlier open brace
17 //Uploaded on Mon Mar 29 21:41:17 EDT 2010
|
Download/View scg/ch02/Square.java