// (c) 1998 Ekkehard Kraemer (ekraemer@pluto.camelot.de) import java.awt.*; /** * Sorry, not documented yet. *
* Source
*/
class Paddle extends Rectangle
{
Paddle(BojngInterface bojng)
{
this.bojng=bojng;
reset();
x=bojng._imgwidth()/2-width/2;
}
void reset()
{
boolean s=isDrawn;
if (s) draw(false);
curSize=1;
changeSize(0);
if (s) draw(true);
}
void changeSize(int diff)
{
boolean s=isDrawn;
if (s) draw(false);
curSize+=diff;
if (curSize<0) curSize=0;
if (curSize>=Images.paddle.length) curSize=Images.paddle.length-1;
width=Images.paddle[curSize].getWidth(null);
height=Images.paddle[curSize].getHeight(null);
y=bojng._imgheight()-height-2;
if (s) draw(true);
}
void moveTo(int x)
{
boolean s=isDrawn;
if (s) draw(false);
this.x=x;
if (s) draw(true);
}
void draw(boolean visible)
{
if (!visible && isDrawn)
bojng.drawBackground(x,y,width,height);
if (visible && !isDrawn)
bojng.drawImage(Images.paddle[curSize],x,y);
isDrawn=visible;
//bojng._update().add(this);
}
void initBall()
{
ballStartAngle=0;
ballStartX=width/2;
}
double getBallAngle()
{
double a=ballStartAngle+PI.halbe;
if (a>Math.PI) a=PI.zwei-a;
if (a