BrickStorage

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 BrickStorage extends GameLoop
10 {
11    /**an oval*/
12    private Sprite[] oval;
13 
14    /**sets up the game*/
15    public void startGame()
16    {
17       makeSprites();
18       addSprites();
19    }
20 
21    /**makes the sprites*/
22    private void makeSprites()
23    {
24       int index=0;
25       oval=new Sprite[10];
26       for(int i=0; i<10; i++)
27       {
28          oval[index]=new OvalSprite(21);
29          oval[index].setScale(0.05);
30          oval[index].setLocation(0.1+i*0.050.5);
31          canvas.addSprite(oval[index]);
32          index++;
33       }
34    }
35 
36    /**adds the sprites to the screen*/
37    private void addSprites()
38    {}
39 
40    /**handle input and game events*/
41    public void advanceFrame(double timePassed)
42    {
43       for(int i=0; i<oval.length; i++)
44       {
45          Point2D.Double click=getPlayer().getMouse().getClickLocation();
46          if(click!=null)
47          {
48             if(oval[i].intersects(click))
49             {
50                oval[i].setColor(Color.RED);
51             }
52          }
53       }
54    }
55 }


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