jam/RunAwayTracker

From ggc

Jump to: navigation, search

01 package jam;
02 
03 import wiki.Wiki;
04 import fang.*;
05 import java.awt.geom.*;
06 /**
07  * All about my class here.
08  @author Jam Jenkins
09  */
10 public class RunAwayTracker extends ProjectileTracker
11 {
12   private Sprite villain;
13   private Sprite goodGuy;
14 
15   public RunAwayTracker(double x, double y)
16   {
17     super(x, y);
18   }
19 
20   public void setVillain(Sprite villain)
21   {
22     this.villain=villain;
23   }
24 
25   public void setGoodGuy(Sprite good)
26   {
27     this.goodGuy=good;
28   }
29 
30   public void advanceTime(double timePassed)
31   {
32     super.advanceTime(timePassed);
33     double angle=Math.atan2(
34                      goodGuy.getLocation().y-villain.getLocation().y,
35                      goodGuy.getLocation().x-villain.getLocation().x);
36     setVelocityDirection(angle);
37     if(goodGuy.getLocation().distance(villain.getLocation())<0.3)
38     {
39       double speed=getVelocity().distance(00);
40       if(speed>0.5)
41         speed=0.5;
42       else
43         speed*=1.05;
44       setVelocity(new Point2D.Double(speed*Math.cos(angle), speed*Math.sin(angle)));
45     }
46     else
47     {
48       double speed=getVelocity().distance(00);
49       if(speed<0.1)
50         speed=0.1;
51       else
52         speed*=0.98;
53       setVelocity(new Point2D.Double(speed*Math.cos(angle), speed*Math.sin(angle)));
54     }
55   }
56 }

Compiler Errors:
----------
1. ERROR in jam/RunAwayTracker.java (at line 30)
	public void advanceTime(double timePassed)
	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cannot override the final method from Transformer
----------
1 problem (1 error)

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