This is my second question regarding a project I'm doing on Space Invaders.

I have reorganized my code to work with Inheritance and ArrayLists.
In my project, the classes Ship, Weapon, and Bullet extend the class Entity (where an Entity is any "thing" that can occur on the game screen, having a co-ordinate, orientation and set of sprites that is represented by an array of filenames)

In the class that handles the gamescreen, I have pre-existing sets of Weapons that can be used directly for their stats for convenience.
These were created using the standard Weapon constructor which contains the super constructor call to Entity.

My problem comes in with the overloaded constructor for Weapon:
I want to relate this Weapon constructor to the Ship the weapons are attached to (note it's two separate weapons that fire in parallel, spaced from the ship's center), so that the Weapon is automatically created with the properties matching the current gameplay scenario (the ship keeps track of which weapon to load and then draw on the screen for each frame).

Here are the classes:

Parent class (Entity)

```
//IMMUTABLE
public class Entity extends Object
{

    //FIELDS
    private final double x;
    private final double y;
    private final double orientation;
    private final String[] sprites;

    //CONSTRUCTOR
    public Entity(double x, double y, double orientation, String[] sprites)
    {
        this.x = x;
        this.y = y;
        this.orientation = orientation;
        this.sprites = sprites;
    }

    //ACCESSORS
    public double getX()
    {
        return this.x;
    }

    public double getY()
    {
        return this.y;
    }

    public double getOrientation()
    {
        return this.orientation;
    }

    private String[] getSprites()
    {
        return this.sprites;
    }
}

```

Sub-classes, Ship and Weapon (I have Bullet as well but if I fix the Weapon problem it will fix the Bullet too)

SHIP:

```
//IMMUTABLE
public class Ship extends Entity
{

    //GLOBAL VARIABLES
    public static final double SHIP_MOVE_INT = 1;
    //100 hp, weapon 0, not moving, no thrusters
    public static final State defState = new State(100, 0, false, false, 0);

    //FIELDS
    private final State state;

    //CONSTRUCTOR
    public Ship(double x, double y, double orientation, String[] sprites, State state)
    {
        super(x, y, orientation, sprites);
        this.state = state;
    }

    //ACCESSORS
    public State getState()
    {
        return this.state;
    }

    //METHODS
    public void moveLeft()
    {
        if (this.x > 15*SHIP_MOVE_INT)
        {
            this.x -= SHIP_MOVE_INT;
        }
    }

    public void moveRight()
    {
        if (this.x < Graphics.X_SCALE - 15*SHIP_MOVE_INT)
        {
            this.x += SHIP_MOVE_INT;
        }
    }

    //Works, but revise
    public void invaderPattern(double gameClock)
    {
        double stage1Bound = 0.3*Graphics.X_SCALE;
        double stage2Bound = stage1Bound + 0.05*Graphics.Y_SCALE;
        double stage3Bound = stage2Bound + stage1Bound;
        double stage4Bound = stage3Bound + 0.05*Graphics.Y_SCALE;

        if (gameClock < stage1Bound)
        {
            //Move right
            this.state.setMovingRight(true);
            this.state.setMovingLeft(false);
            this.x += SHIP_MOVE_INT;
        }
        else if (gameClock >= stage1Bound && gameClock < stage2Bound)
        {
            //Move down
            this.state.setMovingRight(false);
            this.state.setMovingLeft(false);
            this.y -= SHIP_MOVE_INT;
        }
        else if (gameClock >= stage2Bound && gameClock < stage3Bound)
        {
            //Move left
            this.state.setMovingLeft(true);
            this.state.setMovingRight(false);
            this.x -= SHIP_MOVE_INT;
        }
        else
        {
            //Move down
            this.state.setMovingRight(false);
            this.state.setMovingLeft(false);
            this.y -= SHIP_MOVE_INT;
        }
    }
}

```

WEAPON:

```
//IMMUTABLE
public class Weapon extends Entity
{

    //FIELDS
    private final String type;
    private final int damage;
    private final int rof; //Rate of fire
    private final int firingStage;

    //CONSTRUCTORS
    public Weapon(double x, double y, double orientation, String[] sprites, String type, int damage, int rof, int firingStage)
    {
        super(x, y, orientation, sprites);
        this.type = type;
        this.damage = damage;
        this.rof = rof;
        this.firingStage = firingStage;
    }

    public Weapon(double x, Ship defender, double orientation)
    {
        super(x, defender.getY(), orientation, GameScreen.WEAPONS[defender.getState().getWeapon()].getSprites());
        this.type =         GameScreen.WEAPONS[defender.getState().getWeapon()].getType();
        this.damage =       GameScreen.WEAPONS[defender.getState().getWeapon()].getDamage();
        this.rof =          GameScreen.WEAPONS[defender.getState().getWeapon()].getRof();
        this.firingStage =  GameScreen.WEAPONS[defender.getState().getWeapon()].getFiringStage();
    }
    //END OF CONSTRUCTORS

    //ACCESSORS
    public String getType()
    {
        return this.type;
    }

    public int getDamage()
    {
        return this.damage;
    }

    public int getRof()
    {
        return this.rof;
    }

    public int getFiringStage()
    {
        return this.firingStage;
    }

}

```

The error that follows comes from the "super" call in the second Weapon constructor, as well as as the this. assignment calls that follow it, i.e. the whole thing isn't working haha
<https://drive.google.com/file/d/0B7ye7Ul2JDG2cy0yak82eUZaclE/view?usp=sharing>

The reference to the class GameScreen (which itself will refer to Graphics)
are these classes:

GameScreen (I still have to add Mutators)

```
//MUTABLE - NB
public class GameScreen
{
    //GLOBAL VARIABLES
    public static final String HIGH_SCORE_FILE = "highScore.txt";

    //FIELDS
    private Ship defender;
    private Weapon[] weapons;
    private ArrayList invaders;
    private ArrayList bullets;
    private int score;
    private int lives;
    private int highscore;
    private double gameClock;

    //AVAILABLE WEAPONS
    public static final Weapon[][] WEAPONS = new Weapon[][]
    {
        {
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[0], "Machinegun L", 10, 20, 0),
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[0], "Machinegun R", 10, 20, 0)
        },
        {
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[1], "Plasma MG L", 20, 20, 0),
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[1], "Plasma MG L", 20, 20, 0)
        },
        {
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[2], "Photon Cannon L", 40, 5, 0),
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[2], "Photon Cannon R", 40, 5, 0)
        },
        {
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[3], "Alien Destabilizer L", 60, 10, 0),
            new Weapon(0, 0, 0, Graphics.WEAPON_SPRITES[3], "Alien Destabilizer L", 60, 10, 0)
        }
    };

    //AVAILABLE BULLETS
    public static final Bullet[] BULLETS = new Bullet[] //Correspond to WEAPONS above
    {
        new Bullet(0, 0, 0, Graphics.BULLET_SPRITES[0], WEAPONS[0][0].getDamage()),
        new Bullet(0, 0, 0, Graphics.BULLET_SPRITES[1], WEAPONS[1][0].getDamage()),
        new Bullet(0, 0, 0, Graphics.BULLET_SPRITES[2], WEAPONS[2][0].getDamage()),
        new Bullet(0, 0, 0, Graphics.BULLET_SPRITES[3], WEAPONS[3][0].getDamage())
    };

    //CONSTRUCTOR
    public GameScreen(Ship defender, Weapon[] weapons, ArrayList invaders, ArrayList bullets, int score, int lives)
    {
        this.defender = defender;
        this.weapons = weapons;
        this.invaders = invaders;
        this.bullets = bullets;
        this.score = score;
        this.lives = lives;
        this.loadHighscore();
        this.gameClock = 0;
    }

    //METHODS
    public void clk()
    {
        this.gameClock++;
        //Should only be called when the game itself is being played, not menus
    }

    public void loadHighscore()
    {
        try
        {
            Scanner sc = new Scanner(new File(HIGH_SCORE_FILE));
            this.highscore = Integer.parseInt(sc.next());
            sc.close();
        }
        catch(FileNotFoundException fnf)
        {
            System.out.println(fnf);
            this.highscore = 0;
        }
    }

    public void saveHighScore(int highscore)
    {
        try
        {
            FileWriter write = new FileWriter(HIGH_SCORE_FILE);
            PrintWriter pw = new PrintWriter(write);
            pw.print(this.highscore);

            pw.close();
        }
        catch(IOException e)
        {
            System.out.println(e);
        }
    }

    //ACCESSORS
    public Ship getDefender()
    {
        return this.defender;
    }

    public Weapon[] getWeapons()
    {
        return this.weapons;
    }

    public ArrayList getInvaders()
    {
        return this.invaders;
    }

    public ArrayList getBullets()
    {
        return this.bullets;
    }

    public int getScore()
    {
        return this.score;
    }

    public int getHighscore()
    {
        return this.highscore;
    }

    public int getLives()
    {
        return this.lives;
    }

    public double getGameClock()
    {
        return this.gameClock;
    }

}

```

GRAPHICS:

```
//LIBRARY
public class Graphics
{

    //GLOBAL VARIABLES
    public static final int REFRESH_RATE = 20; //delay in milliseconds
    public static final double X_SCALE = 100;
    public static final double Y_SCALE = 100;
    public static final int X_SIZE = 512;
    public static final int Y_SIZE = 624;
    //Cycles of 4 stage motions
    public static final double gameClockMax = X_SCALE*(0.6) + Y_SCALE*(0.1);

    //SPRITES
    public static final String[][] SHIP_SPRITES =
    {
        {"BasicShip_TRANS.png"},    //Defender  [0][...]
        {"BasicInvader_TRANS.png"}  //Invader   [1][...]
    };

    public static final String[][] WEAPON_SPRITES =
    {
        {"MG_L_TRANS.png", "MG_R_TRANS.png"},   //Machine Gun           [0][...]
        {"PMG_L_TRANS.png", "PMG_R_TRANS.png"}, //Plasma Machine Gun    [1][...]
        {"PC_L_TRANS.png", "PC_R_TRANS.png"},   //Photon Cannon         [2][...]
        {"AD_L_TRANS.png", "AD_R_TRANS.png"}    //Alien Destabilizer    [3][...]
    };

    public static final String[][] BULLET_SPRITES =
    {
        {"MG_PROJ_TRANS.png"},
        {"PMG_PROJ_TRANS.png"},
        {"PC_PROJ_TRANS.png"},
        {"AD_PROJ.png"}
    };
    //END OF SPRITES

    //FUNCTIONS
    public static void drawMenu()
    {
        StdDraw.clear(StdDraw.GRAY);
        StdDraw.text(50, 80, "THE SWARM");
        StdDraw.text(50, 50, "P - Play");
        StdDraw.text(50, 40, "Q - Quit");
    }

    public static void init()
    {
        StdDraw.setCanvasSize(X_SIZE, Y_SIZE);
        StdDraw.setXscale(0.0, X_SCALE);
        StdDraw.setYscale(0.0, Y_SCALE);
        drawMenu();
    }

    public static void drawShip(int type, Ship ship) // type: 0 Defender , 1 Invader
    {
        if (type > 1 || type < 0)
        {
            System.out.println("Invalid ship type");
            return;
        }
        int hp = ship.getState().getHealth();
        if (hp > 80) StdDraw.picture(ship.getX(), ship.getY(), SHIP_SPRITES[type][0]);
        //TODO
    }

    public static double orientation(Ship defender) //Determine weapon orientation to mouse pointer direction
    {
        //Clockwise rotation thus 270 + theta

        if (defender.getX() < StdDraw.mouseX())
        {
            if (defender.getY() < StdDraw.mouseY())
            {
                return 270 + Math.toDegrees(Math.atan((StdDraw.mouseY() - defender.getY())/(StdDraw.mouseX() - defender.getX())));
            }
            else
            {
                return 270;
            }
        }
        else if (defender.getX() > StdDraw.mouseX())
        {
            if (defender.getY() < StdDraw.mouseY())
            {
                return (180) + (270 + Math.toDegrees(Math.atan((StdDraw.mouseY() - defender.getY())/(StdDraw.mouseX() - defender.getX()))));
            }
            else
            {
                return 90;
            }

        }
        else
        {
            return 0;
        }

    }

    public static void drawWeapons(Weapon[] weapons)
    {
        //Left
        StdDraw.picture
        (
            weapons[0].getX(),
            weapons[0].getY(),
            weapons[0].getSprites()[0],
            weapons[0].getOrientation()
        );
        //Right
        StdDraw.picture
        (
            weapons[1].getX(),
            weapons[1].getY(),
            weapons[1].getSprites()[1],
            weapons[1].getOrientation()
        );
    }

    public static void drawBullet(Bullet bullet)
    {
        StdDraw.picture
        (
            bullet.getX(),
            bullet.getY(),
            bullet.getSprites()[0],
            bullet.getOrientation()
        );
    }

    //Primary function
    public void animate(GameScreen gs)
    {
        //TODO
        //accept display of stats (hp, lives, score, etc)

        /* Order of drawing:
         * 1 - Background
         * 2 - Borders
         * 3 - Stats
         * 4 - Thrusters
         * 5 - Weapons
         * 6 - Ships
         * 7 - Bullets
         * 8 - Effects
         * 9 - Notifications (Combo indicators etc)
         */

        //1
        StdDraw.clear(StdDraw.GRAY);

        //5
        drawWeapons(gs.getWeapons());

        //6
        drawShip(gs.getDefender());

        for (int i = 0; i < gs.getInvaders().size(); i++)
        {
            gs.getInvaders().get(i).invaderPattern(gs.getGameClock());
            drawShip(gs.getInvaders().get(i));
        }

        //REFRESH RATE DELAY
        StdDraw.show(REFRESH_RATE);

    }

}

```

So to summarize, I'm trying to overload the Weapon constructor so that it sets itself up using existing Weapon configurations (listed in GameScreen, made using first Weapon constructor), one of which will be chosen depending on the Ship's weapon type state.
The compiler complains quite a bit about this and I'm trying to determine why >.<