I need help with implement an old code of bullet in new program. when i try to compile i get an error with the vecktor class in line 20
code
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
public class Bullet extends SmoothMover
{
/** The damage this bullet will deal */
private static int damage = 20;
/** A bullet looses one life each act, and will disappear when life = 0 */
private int life = 30;
private int rayGunLife = 40;
GreenfootSound sound =new GreenfootSound("EnergyGun.mp3");
public Bullet()
{
}
/**
* Allows the Bullet image to be changed to the RayGun image when called
* and boolean ray is true
*/
public Bullet(Vector speed, int rotation, boolean ray)
{
super(speed);
setRotation(rotation);
addForce(new Vector(rotation, 15));
sound.play();
damage = 15;
setImage("RayGunFull.png");
}
/**
* Adds a Bullet when call
*/
public Bullet(Vector speed, int rotation)
{
super(speed);
setRotation(rotation);
addForce(new Vector(rotation, 15));
sound.play();
}
/**
* The bullet will damage Bug if it hits them.
*/
public void act()
{
if(life <= 0)
{
getWorld().removeObject(this);
}
else
{
life--;
move();
checkBugHit();
}
}
/**
* Check whether we have hit an Bug.
*/
private void checkBugHit()
{
Bug Bug = (Bug) getOneIntersectingObject(Bug.class);
if (Bug!= null)
{
getWorld().removeObject(this);
Bug.hit(damage);
}
}
}