Then what could be possibly creating the lamp object..? I haven't altered it and I'm still getting the object.
import greenfoot.*;
public class Level1 extends World
{
GifImage gif = new GifImage("Level1.gif");
boolean colored = false;
int size;
GreenfootImage darkness;
public Level1()
{
super(600, 400, 1);
setPaintOrder(Lamp.class, Beam.class);
prepare();
}
public void act()
{
setBackground(gif.getCurrentImage());
}
private void prepare()
{
Wreckage wreckage = new Wreckage();
addObject(wreckage,350,295);
wreckage.setLocation(323,279);
Lamp lamp = new Lamp();
CrashedShip crashedship = new CrashedShip();
addObject(crashedship,142,246);
crashedship.setLocation(34,377);
crashedship.setLocation(23,379);
Wau2 wau2 = new Wau2();
addObject(wau2,181,263);
wau2.setLocation(29,382);
Wau2 wau22 = new Wau2();
addObject(wau22,145,285);
wau22.setLocation(14,115);
wau22.setLocation(18,116);
Wau2 wau23 = new Wau2();
addObject(wau23,279,192);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(29,230);
wau23.setLocation(3,317);
Wau2 wau24 = new Wau2();
addObject(wau24,259,265);
wau24.setLocation(46,236);
Wau2 wau25 = new Wau2();
addObject(wau25,170,274);
wau25.setLocation(31,274);
Wau2 wau26 = new Wau2();
addObject(wau26,201,296);
wau26.setLocation(89,384);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(5,180);
wau26.setLocation(6,308);
wau26.setLocation(10,178);
addObject(lamp, 300, 10);
lamp.setRotation(90);
addObject(new Beam(lamp, 40), 300, 10);
Beam beam = new Beam(lamp, 40);
addObject(beam, 300, 10);
beam.act();
}
} lamp.setRotation(135);
Beam beam = new Beam(lamp, 40);
addObject(beam, 300, 5);
beam.act();
addObject(lamp, 600, 5);
lamp.setRotation(100);
addObject(beam, 300, 5);
beam.act();