jam/LighterDarker

From ggc

Jump to: navigation, search

01 package jam;
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 LighterDarker 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 OvalSprite(21);
28     oval.setScale(0.75);
29     oval.setLocation(0.50.5);
30     oval.setColor(Color.BLUE);
31   }
32 
33   /**adds the sprites to the screen*/
34   private void addSprites()
35   {
36     canvas.addSprite(oval);
37   }
38 
39   /**handle input and game events*/
40   public void advanceFrame(double timePassed)
41   {
42     if(getPlayer().getMouse().getLeftClickLocation()!=null)
43     {
44       oval.setColor(oval.getColor().brighter());
45     }
46     if(getPlayer().getMouse().getRightClickLocation()!=null)
47     {
48       oval.setColor(oval.getColor().darker());
49     }
50   }
51 }


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