RotateExample

From ggc

Jump to: navigation, search

01 import fang.*;
02 import java.awt.*;
03 import java.awt.geom.*;
04 
05 /**
06  * All about my game here.
07  @author Jam Jenkins
08  */
09 public class RotateExample extends GameLoop
10 {
11   /**an oval*/
12   private Sprite oval;
13   private ProjectileTracker track;
14   /**sets up the game*/
15   public void startGame()
16   {
17     makeSprites();
18     addSprites();
19     setHelpText("watch it rotate");
20   }
21 
22   /**makes the sprites*/
23   private void makeSprites()
24   {
25     oval=new OvalSprite(21);
26     oval.setScale(0.75);
27     oval.setLocation(0.50.5);
28     Point2D.Double direction=new Point2D.Double(0.00.0);
29     track=new ProjectileTracker(direction);
30     /**rotate 1/2 a revolution per second*/
31     track.setAngularVelocity(3.14);
32     oval.setTracker(track);
33   }
34 
35   /**adds the sprites to the screen*/
36   private void addSprites()
37   {
38     canvas.addSprite(oval);
39   }
40 }


Download/View RotateExample.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