lights/UsingLightsOutModel

From ggc

Jump to: navigation, search

01 package lights;
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 UsingLightsOutModel extends GameLoop
13 {
14   /**an oval*/
15   private Sprite oval;
16   private LightsOutModel model;
17 
18   /**sets up the game*/
19   public void startGame()
20   {
21     model=new LightsOutModel();
22     makeSprites();
23     addSprites();
24   }
25 
26   /**makes the sprites*/
27   private void makeSprites()
28   {
29     oval=new OvalSprite(21);
30     oval.setScale(0.75);
31     oval.setLocation(0.50.5);
32   }
33 
34   /**adds the sprites to the screen*/
35   private void addSprites()
36   {
37     canvas.addSprite(oval);
38   }
39 
40   /**handle input and game events*/
41   public void advanceFrame(double timePassed)
42   {
43     if(getPlayer().getMouse().getClickLocation()!=null)
44     {
45       /**if they click assume it was at 2, 2*/
46       model.play(22);
47       oval.setVisible(model.isOn(22));
48     }
49   }
50 }


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