ummm i have one question, what exactly do i put on the etc. part? sorry if this question is pretty dumb
public class Cop extends Actor
{
public GreenfootImage crashed = new GreenfootImage("wreckedcar2.png");
public boolean alive = true;
public void act() {
if (alive) {
java.util.List<Car> playersInWorld = getWorld().getObjects(Car.class);
}
}
public void moveToPlayer(Car player) {
turnTowards(player.getX(), player.getY());
move(1);
setRotation(0);
if ( alive )
{
Actor c = this.getOneIntersectingObject(Vehicle.class);
if( c != null)
{
Greenfoot.playSound("Crash.wav");
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore2();
return;
}
Actor d = this.getOneIntersectingObject(Tree.class);
if( d != null)
{
Greenfoot.playSound("Crash.wav");
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
Actor e = this.getOneIntersectingObject(Spikes.class);
if( e != null)
{
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
Actor f = this.getOneIntersectingObject(Missiles.class);
if( f != null)
{
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
}
}
}public class Cop extends Actor
{
public GreenfootImage crashed = new GreenfootImage("wreckedcar2.png");
public boolean alive = true;
public void act() {
if (alive) {
java.util.List<Car> playersInWorld = getWorld().getObjects(Car.class);
if ( !playersInWorld.isEmpty() )
{
moveToPlayer( playersInWorld.get(0) );
}
}
}
public void moveToPlayer(Car player) {
turnTowards(player.getX(), player.getY());
move(1);
setRotation(0);
if ( alive )
{
Actor c = this.getOneIntersectingObject(Vehicle.class);
if( c != null)
{
Greenfoot.playSound("Crash.wav");
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore2();
return;
}
Actor d = this.getOneIntersectingObject(Tree.class);
if( d != null)
{
Greenfoot.playSound("Crash.wav");
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
Actor e = this.getOneIntersectingObject(Spikes.class);
if( e != null)
{
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
Actor f = this.getOneIntersectingObject(Missiles.class);
if( f != null)
{
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
}
}
}
public class Cop extends Actor
{
public GreenfootImage crashed = new GreenfootImage("wreckedcar2.png");
public boolean alive = true;
public void act() {
if (alive) {
java.util.List<Car> playersInWorld = getWorld().getObjects(Car.class);
if ( !playersInWorld.isEmpty() )
{
moveToPlayer( playersInWorld.get(0) );
}
}
else setLocation(getX(), getY()+Car.speed );
}
public void hitBottom()
{
if (getY()>=getWorld().getHeight()-1)
{
getWorld().removeObject(this);
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore4();
}
}
public void moveToPlayer(Car player) {
turnTowards(player.getX(), player.getY());
move(1);
setRotation(0);
if ( alive )
{
Actor c = this.getOneIntersectingObject(Vehicle.class);
if( c != null)
{
Greenfoot.playSound("Crash.wav");
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore2();
return;
}
Actor d = this.getOneIntersectingObject(Tree.class);
if( d != null)
{
Greenfoot.playSound("Crash.wav");
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
Actor e = this.getOneIntersectingObject(Spikes.class);
if( e != null)
{
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
Actor f = this.getOneIntersectingObject(Missiles.class);
if( f != null)
{
//getWorld().removeObject(this);
setImage(crashed);
alive = false;
World myWorld = getWorld();
CarWorld carworld = (CarWorld)myWorld;
Counter counter = carworld.getCounter();
counter.addScore3();
return;
}
}
hitBottom();
}
}