MY FIRST UNIT
Specialization and Customization

CUSTOMIZING UNITS

The Basics


EXAMPLE: THE TANK CLASS

Getting Started


Customizing the Tank


public class Tank extends MyTeamUnit

{

public Tank (MyTeam p)  

{

super(p);

}

public void design()

{

setFrame(Frame.HEAVY);

setModel(Model.BASTION);

setStyle(Style.WEDGE);

addWeapon(new Autocannon(this));

addUpgrade(new Plating(this));

addUpgrade(new Plating(this));

addUpgrade(new Plating(this));

}

}

 Player Class - Building the Tank


public void strategy() 

{

if(getFleetValuePercentage(Gatherer.class) < .2f)

{

buildUnit(new Gatherer(this));

}

else if(getFleetValuePercentage(Miner.class) < .2f)

{

buildUnit(new Miner(this));

}

      else if(getFleetValuePercentage(Tank.class) < .3f)

{

buildUnit(new Tank(this));

}

else

{

buildUnit(new Fighter(this));

}

}

Run your code.  How does this unit work with the other fighters? 

SPECIALIZING UNITS

Some Unit Ideas

MOVEMENT SPEEDS

You may find that as you customize units, they move at very different speeds.  Let's consider a few strategies:


Adjusting Speeds

Early on, the easiest option is to keep unit speeds to be similar.  Play with variables, such as:


Keep It Together

You can write code to keep your units in a formation

Different Roles, Different Placement

Your very fast units may want to break off from the main fleet!