Jam/ReturnTypeExample

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 ReturnTypeExample extends GameLoop
13 {
14   /**sets up the game*/
15   public void startGame()
16   {
17     canvas.addSprite(makeRandomSprite());
18     canvas.addSprite(makeRandomSprite());
19     canvas.addSprite(makeRandomSprite());
20     canvas.addSprite(makeRandomSprite());
21     canvas.addSprite(makeRandomSprite());
22     canvas.addSprite(makeRandomSprite());
23     canvas.addSprite(makeRandomSprite());
24     canvas.addSprite(makeRandomSprite());
25     canvas.addSprite(makeRandomSprite());
26   }
27 
28   private Sprite makeRandomSprite()
29   {
30     Sprite x=new PolygonSprite(random.nextInt(6)+3);
31     x.setScale(random.nextDouble());
32     x.setLocation(random.nextDouble(), random.nextDouble());
33     x.setColor(getRandomColor());
34     return x;
35   }
36 
37   private Color getRandomColor()
38   {
39     Color color=new Color(random.nextFloat(), random.nextFloat(), random.nextFloat());
40     return color;
41   }
42 }


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