scg/ch02/Basket

From FANG

Jump to: navigation, search

01 package scg.ch02;
02 
03 import fang2.core.Game;
04 import fang2.sprites.RectangleSprite;
05 
06 /**
07  * Draw a basket (for "basketball") on the screen. 
08  */
09 public class Basket
10   extends Game {
11   /**
12    * Setup the sprites (and anything else) necessary for our game. 
13    * Use the new operator to construct three RectangleSprites. Each is 
14    * sized and located in screens (screen is 0.0 to 1.0 from left to right
15    * across and 0.0 to 1.0 down from the top to bottom (y-axis is backward).
16    */
17   @Override
18   public void setup() {
19     // width, height (in screens); location is (x, y), in screens
20     RectangleSprite rectangleBottom = new RectangleSprite(0.250.05);
21     rectangleBottom.setLocation(0.6250.475);
22     addSprite(rectangleBottom);
23 
24     RectangleSprite rectangleBackboard = new RectangleSprite(0.050.4);
25     rectangleBackboard.setLocation(0.750.3);
26     addSprite(rectangleBackboard);
27 
28     RectangleSprite rectangleFrontboard = new RectangleSprite(0.050.2);
29     rectangleFrontboard.setLocation(0.500.4);
30     addSprite(rectangleFrontboard);
31   }
32 }
33 
34 //Uploaded on Mon Mar 29 21:40:56 EDT 2010


Download/View scg/ch02/Basket.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter

Games
Games