breakout
Class ShooterBumper

java.lang.Object
  |
  +--breakout.DefaultBreakoutComponent
        |
        +--breakout.Bumper
              |
              +--breakout.ShooterBumper
All Implemented Interfaces:
BreakoutComponent, EventListener, MouseListener, MouseMotionListener

public class ShooterBumper
extends Bumper

A cooler Bumper that shoots SingleShotBalls when the user clicks the mouse.

Version:
$Id: ShooterBumper.html,v 1.1 2003/03/10 16:34:48 bvandiver Exp $
Author:
benmv@olin.edu
See Also:
SingleShotBall

Constructor Summary
ShooterBumper(Point location, Dimension size, World w, int ammo)
           
 
Method Summary
 void mouseClicked(MouseEvent e)
          When mouse is clicked, creates a SingleShotBall going straight up centered on the Bumper.
 void paint(Graphics g)
          renders like bumper, but also displays ammo left in green.
 
Methods inherited from class breakout.Bumper
hitBy, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased
 
Methods inherited from class breakout.DefaultBreakoutComponent
getCenter, getLocation, getShape, getSize, isDead, isTransient, kill, setLocation, setWorld
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShooterBumper

public ShooterBumper(Point location,
                     Dimension size,
                     World w,
                     int ammo)
Method Detail

paint

public void paint(Graphics g)
renders like bumper, but also displays ammo left in green.

Specified by:
paint in interface BreakoutComponent
Overrides:
paint in class Bumper
Parameters:
g - Graphics used to render the bumper.

mouseClicked

public void mouseClicked(MouseEvent e)
When mouse is clicked, creates a SingleShotBall going straight up centered on the Bumper. That is, assuming the player has any ammo left.

Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class Bumper
Parameters:
e - MouseEvent that indicates the mouse state.