Wednesday, November 26, 2008

Asteroids Java 2D Tutorial Part 4

We need some more interfaces for our game that you should create. The below interface will be used to know which objects are selectable.

Selectable.java



public interface Selectable
{


public boolean contains(int x, int y);


public void setSelected(boolean newVal);


public boolean isSelected();

}


The below interface is used for the objects that will be steerable.  This interface will allow you to change your speed and heading.

Steerable.java


public interface Steerable
{

public void changeSpeed(int amount);
public void changeHeading(int amount);

}


Go To Part 5

0 comments: