Merima/deal

From ggc

Jump to: navigation, search

001 package Merima;
002 
003 import wiki.Wiki;
004 import fang.*;
005 import java.awt.*;
006 import java.awt.geom.*;
007 
008 /**
009  * All about my game here.
010  @author Merima Omanovic
011  */
012 public class deal extends GameLoop
013 {
014   private Sprite  box1;
015   private Sprite  box2;
016   private Sprite  box3;
017   private Sprite  box1Label;
018   private Sprite  box2Label;
019   private Sprite  box3Label;
020   private Sprite  RedDot;
021   private Sprite  RedDot2;
022   private Sprite  GreenDot;
023   private Sprite  Instructions;
024   private Sprite  Instructions2;
025   private Sprite  Instructions3;
026   private int winningDoor;
027   Sound sound=new Sound(Wiki.getMedia("Beep1.wav"));
028 
029 
030 
031 
032 
033   public void startGame()
034   {
035     makeSprites();
036     addSprites();
037     toggleAudible();
038   }
039 
040   private void makeSprites()
041   {
042 
043     Instructions=new StringSprite("1. Pick a door!");
044     Instructions.setScale(0.5);
045     Instructions.setLocation(.5.3);
046     Instructions.setColor(Color.PINK);
047 
048     Instructions2=new StringSprite("2. Pick another door!");
049     Instructions2.setScale(0.7);
050     Instructions2.setLocation(0.50.7);
051     Instructions2.setColor(Color.PINK);
052 
053     Instructions3=new StringSprite("3. Goodluck!");
054     Instructions3.setScale(0.6);
055     Instructions3.setLocation(0.50.8);
056     Instructions3.setColor(Color.RED);
057 
058     box1=new RectangleSprite(11);
059     box1.setScale(0.25);
060     box1.setLocation(0.50.5);
061 
062     box1Label=new StringSprite("2");
063     box1Label.setScale(0.15);
064     box1Label.setLocation(0.50.5);
065     box1Label.setColor(Color.WHITE);
066 
067 
068     RedDot=new ImageSprite(Wiki.getMedia("After.gif"));
069     RedDot.setScale(.1);
070     RedDot.setLocation(0.50.5);
071     RedDot.setColor(Color.RED);
072 
073 
074     box2=new RectangleSprite(11);
075     box2.setScale(0.25);
076     box2.setLocation(0.80.5);
077 
078     box2Label=new StringSprite("3");
079     box2Label.setScale(0.15);
080     box2Label.setLocation(0.8,0.5);
081     box2Label.setColor(Color.WHITE);
082 
083     RedDot2=new ImageSprite(Wiki.getMedia("After.gif"));
084     RedDot2.setScale(.1);
085     RedDot2.setLocation(0.80.5);
086     RedDot2.setColor(Color.RED);
087 
088     box3=new RectangleSprite(11);
089     box3.setScale(0.25);
090     box3.setLocation(0.20.5);
091 
092     box3Label=new StringSprite("1");
093     box3Label.setScale(0.15);
094     box3Label.setLocation(0.2,0.5);
095     box3Label.setColor(Color.WHITE);
096 
097     GreenDot=new ImageSprite(Wiki.getMedia("Coin1.gif"));
098     GreenDot.setScale(.1);
099     GreenDot.setLocation(0.20.5);
100     GreenDot.setColor(Color.GREEN);
101   }
102 
103   private void addSprites()
104   {
105     canvas.addSprite(Instructions);
106     canvas.addSprite(Instructions2);
107     canvas.addSprite(Instructions3);
108     canvas.addSprite(RedDot);
109     canvas.addSprite(RedDot2);
110     canvas.addSprite(GreenDot);
111     canvas.addSprite(box1);
112     canvas.addSprite(box2);
113     canvas.addSprite(box3);
114     canvas.addSprite(box1Label);
115     canvas.addSprite(box2Label);
116     canvas.addSprite(box3Label);
117 
118 
119 
120 
121 
122   }
123 
124   public void advanceFrame(double timePassed)
125   {
126     Point2D.Double click=getPlayer().getMouse().getClickLocation();
127     //did they click at all
128     if(click!=null)
129     {
130       if(box3.intersects(click))
131       {
132         canvas.removeSprite(box1);
133         canvas.removeSprite(box1Label);
134       }
135 
136       if(box1.intersects(click))
137       {
138         canvas.removeSprite(box3);
139         canvas.removeSprite(box3Label);
140 
141       }
142       if(box2.intersects(click))
143 
144       {
145         int q=random.nextInt(2);
146         if(q==0)
147         {
148           canvas.removeSprite(box3);
149           canvas.removeSprite(box3Label);
150         }
151         else if(q==1)
152         {
153           canvas.removeSprite(box1);
154           canvas.removeSprite(box1Label);
155         }
156       }
157     }
158   }
159 
160 
161 }

Compiler Errors:
----------
1. ERROR in Merima/deal.java (at line 68)
	RedDot=new ImageSprite(Wiki.getMedia("After.gif"));
	       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
2. ERROR in Merima/deal.java (at line 83)
	RedDot2=new ImageSprite(Wiki.getMedia("After.gif"));
	        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
3 problems (3 errors)

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