Class republikensoft.Bullet
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class republikensoft.Bullet

java.lang.Object
   |
   +----republikensoft.Moving
           |
           +----republikensoft.Bullet

public class Bullet
extends Moving
Bullet is the class that contains most hairy code since it does some sort of collision detection.

Variable Index

 o maxBorderPass
How may times a bullet can pass the vertical edges.
 o maxMilage
How many pixels a bullet can travel, at most.

Constructor Index

 o Bullet()
All bullets are created by a Player.

Method Index

 o draw(Graphics)
Draws the bullet translated a couple of pixels so coord is the centre of the bullet.
 o fire(int, int, int)
Fires a new bullet.
 o update()
Updates the bullet.

Variables

 o maxBorderPass
  public final static int maxBorderPass
How may times a bullet can pass the vertical edges. Currently set to 2.
 o maxMilage
  public final static int maxMilage
How many pixels a bullet can travel, at most. Used to prevent endless ricochet loops. Measured in Manhattan distance. Currently set to 2000.

Constructors

 o Bullet
  public Bullet()
All bullets are created by a Player.
See Also:
Player

Methods

 o draw
  public void draw(Graphics g)
Draws the bullet translated a couple of pixels so coord is the centre of the bullet.
Overrides:
draw in class Moving
 o fire
  public void fire(int x,
                   int y,
                   int speed)
Fires a new bullet.
Parameters:
x - x-coordinate
y - y-coordinate
s - initial horizontal speed
 o update
  public void update()
Updates the bullet.
Overrides:
update in class Moving

All Packages  Class Hierarchy  This Package  Previous  Next  Index