grid/ShowGrid

From ggc

Jump to: navigation, search

01 package grid;
02 
03 import wiki.Wiki;
04 import fang.*;
05 import java.awt.*;
06 import java.awt.geom.*;
07 
08 /**
09  * All about my game here.
10  @author Jam Jenkins
11  */
12 public class ShowGrid extends GameLoop
13 {
14   /**an oval*/
15   private Sprite oval;
16 
17   /**sets up the game*/
18   public void startGame()
19   {
20     makeSprites();
21     addSprites();
22   }
23 
24   /**makes the sprites*/
25   private void makeSprites()
26   {
27     oval=new Grid(550.05);
28     oval.setScale(0.75);
29     oval.setLocation(0.50.5);
30   }
31 
32   /**adds the sprites to the screen*/
33   private void addSprites()
34   {
35     canvas.addSprite(oval);
36   }
37 
38   /**handle input and game events*/
39   public void advanceFrame(double timePassed)
40   {
41     oval.setLocation(getPlayer().getMouse().getLocation());
42     if(getPlayer().getMouse().getClickLocation()!=null)
43     {
44       oval.setScale(random.nextDouble());
45     }
46     if(getPlayer().getKeyboard().getLastKey()=='r')
47     {
48       oval.setColor(Color.RED);
49     }
50     if(getPlayer().getKeyboard().getLastKey()=='w')
51     {
52       oval.setColor(Color.WHITE);
53     }
54   }
55 }


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