This is the code for the bullet thank you very much
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Bullet here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bullet extends Actor
{
/**
* Act - do whatever the Bullet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move();
// This calls on the method code so that it works
Dead();
// This calls on the method code so that it works
}
public void move()
{
move(15); // this moves the Bullet straingh at the speed of 15
}
private void Dead()
{
Actor Rock = getOneIntersectingObject(Rock.class);
if(Rock !=null)
{
World myWorld = getWorld();
myWorld.removeObject (Rock);
Start start = (Start)myWorld;
Counter counter = start.getCounter();
counter.addScore();
// This code means that when the enemy is killed it adds 1 to the score.
myWorld.removeObject(this);
// This code means that when the the Bullet hits the Rock the Rock will disapre
}
}
}

