examples/sprites/ImageSpriteExample

From FANG

Jump to: navigation, search
null

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 Example displays an ImageSprite on the screen.
14  @author Alan Davis
15  */
16 public class ImageSpriteExample extends Game
17 {
18   /**Here we are declaring our sprite named dude*/
19   Sprite dude;
20 
21   /**sets up the game*/
22   public void setup()
23   {
24     /**instantiating the Imagesprite and I have uploaded the file Dude2.png already
25     ** We tell the game that it is there and thats the one to use.
26     **Make sure to include the parenthises.
27     */
28     dude = new ImageSprite("Dude2.png");
29 
30     /**The image is located in the center of the screen*/
31     dude.setLocation(0.50.5);
32     /**This sets the image size to half of the screen size*/
33     dude.setSize(0.5);
34     /**This adds the sprite to the screen*/
35     addSprite(dude);
36   }
37 }


Download/View examples/sprites/ImageSpriteExample.javanull





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