examples/sprites/RectangleSpriteExample

From FANG

Jump to: navigation, search

01 package examples.sprites;
02 //start auto-imports
03 //end auto-imports
04 
05 import fang2.core.*;
06 import fang2.sprites.*;
07 import fang2.transformers.*;
08 import fang2.attributes.*;
09 import java.awt.*;
10 import java.awt.geom.*;
11 
12 /**
13  * This is an example of a RectangleSprite.
14  @author Alan Davis
15  */
16 
17 public class RectangleSpriteExample extends Game
18 {
19   /**Here we declare our sprite named rectangle.  You can declare a RectangleSprite,
20   ***but Sprite is the class that the RectangleSprite is derived from
21   **/
22   Sprite rect;
23   
24   /**sets up the game*/
25   public void setup()
26   {
27     /**Here, we instantiate the rectangle and give it a width and height*/
28     rect = new RectangleSprite.1.2 );
29     /**Here, the location in screens is set.
30     ***This means we are putting the Rectangle at half the screen's width and height
31     **/
32     rect.setLocation0.50.5 );
33     /**Here is where we add our sprite to the screen*/
34     addSpriterect );
35   }
36   
37 }


Download/View examples/sprites/RectangleSpriteExample.java//start auto-imports //end auto-imports

import fang2.core.*; import fang2.sprites.*; import fang2.transformers.*; import fang2.attributes.*; import java.awt.*; import java.awt.geom.*;

/**

* This is an example of a RectangleSprite.
* @author Alan Davis
*/

public class ARectangle extends Game { /**Here we declare our sprite named rectangle. You can declare a RectangleSprite, ***but Sprite is the class that the RectangleSprite is derived from **/ Sprite rect;

/**sets up the game*/ public void setup() { /**Here, we instantiate the rectangle and give it a width and height*/ rect = new RectangleSprite( .1, .2 ); /**Here, the location in screens is set. ***This means we are putting the Rectangle at half the screen's width and height **/ rect.setLocation( 0.5, 0.5 ); /**Here is where we add our sprite to the screen*/ addSprite( rect ); }

}





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