example.payment.jbricks
Class Ball

java.lang.Object
  extended by example.payment.jbricks.Sprite
      extended by example.payment.jbricks.Ball

public class Ball
extends Sprite

This class implements the ball, with its radius, and x and y step size. The ball knows how to draw itself, and every once in a while it will do a subtle, pseudo-random path modification to prevent closed ball paths.


Field Summary
static int RADIUS
           
 
Fields inherited from class example.payment.jbricks.Sprite
height, shadow, width, x, y
 
Constructor Summary
Ball(int x, int y, int dx, int dy)
           
 
Method Summary
 void bounce(Sprite other)
           
 void bounceHorizontal()
           
 void bounceVertical()
           
 int getXStep()
           
 int getYStep()
           
 void move()
           
 void paint(javax.microedition.lcdui.Graphics g)
           
 void paintShadow(javax.microedition.lcdui.Graphics g)
           
 void setSteps(int dx, int dy)
           
 
Methods inherited from class example.payment.jbricks.Sprite
getCenterX, getCenterY, intersects, moveBy, moveTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIUS

public static final int RADIUS
Constructor Detail

Ball

public Ball(int x,
            int y,
            int dx,
            int dy)
Method Detail

setSteps

public void setSteps(int dx,
                     int dy)

getXStep

public int getXStep()

getYStep

public int getYStep()

move

public void move()

bounceHorizontal

public void bounceHorizontal()

bounceVertical

public void bounceVertical()

bounce

public void bounce(Sprite other)

paintShadow

public void paintShadow(javax.microedition.lcdui.Graphics g)
Overrides:
paintShadow in class Sprite

paint

public void paint(javax.microedition.lcdui.Graphics g)
Overrides:
paint in class Sprite