Friday, July 23, 2010

Java 2D Tutorial Creating an Asteroid Game Part 2

We are going to need some interfaces for this game. You should create 6 more classes for your interfaces. They should be called Collider.java, Drawable.java, Move.java, Moveable.java, Selectable.java, and Steerable.java.


Collider.java

import java.awt.Point;


public interface Collider
{
public boolean bounds(Point p1,Point p2);
public void collision();
public boolean removeCollision();
}


The above interface will be used for an object that should implement the collision methods.

The below interface will be used for objects that need to be drawed on the screen.


Drawable.java

import java.awt.Graphics2D;




public interface Drawable
{

public void draw(Graphics2D g);

}

Go To Part 3

0 comments: