Textfeld:

Kegeln auf Java

Dokumentation und Code

Kegel

bowling_all
Class Kegel

java.lang.Object
  extended by bowling_all.Kegel

public final class Kegel
extends java.lang.Object

Class Kegel forms a bowling-pin

Author:
Biber & PhiSch

Method Summary
 double angelToBall(double kugelspeedX, double kugelspeedY, double kugelaccellerationX, int time)
          calculates the actual angle of the ball to the coordinate system
 void doPaint(java.awt.Graphics g, java.awt.Image i4, java.awt.Image i3, java.awt.Image i2, java.awt.Image i1, java.awt.Image i0)
          paints a graphic of the pin
 boolean getCollision()
          checks if the pin is already fallen
 double getEposX()
          gets the actual x-coordinate of the top of the pin
 double getEposY()
          gets the actual y-coordinate of the top of the pin
 int getPostionX()
          gets the actual x-coordinate of the bottom of the pin
 int getPostionY()
          gets the actual y-coordinate of the bottom of the pin
 void if_collisionBall(Kugel k, int time)
          checks if the ball k collides at time time with the pin
 void if_collisionPin(Kegel p, int time)
          checks if the pin collides with another pin p at time time
 void kollision_mit_Kugel(double kugelspeedX, double kugelspeedY, double kugelaccellerationX, int time, double angleToGo)
          sets the time of collison and the speed and the angle of the pin
 void reset()
          resets the pin to his start-values
 void reset2()
          sets the pin as hit and to a position outside the shown area, so he will not appear on the screen
 void set_posX(int time)
          sets the x coordinate of a pin at a certain time
 void set_posY(int time)
          sets the y coordinate of a pin at a certain time
 double x_transformToNew(double x, double y, double nX0, double nY0, double angle)
          does a coordinate transformation (X)
 double y_transformToNew(double x, double y, double nX0, double nY0, double angle)
          does a coordinate transformation (Y)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPostionY

public int getPostionY()
gets the actual y-coordinate of the bottom of the pin

Returns:
y-coordinate of the bottom end of the pin

getPostionX

public int getPostionX()
gets the actual x-coordinate of the bottom of the pin

Returns:
x-coordinate of the bottom of the pin

getEposX

public double getEposX()
gets the actual x-coordinate of the top of the pin

Returns:
x-coordinate of the top of the pin

getEposY

public double getEposY()
gets the actual y-coordinate of the top of the pin

Returns:
y-coordinate of the top of the pin

getCollision

public boolean getCollision()
checks if the pin is already fallen

Returns:
true if the pin is already fallen, false if not

set_posX

public void set_posX(int time)
sets the x coordinate of a pin at a certain time

Parameters:
time - actual time (0 is the start of the animation)

set_posY

public void set_posY(int time)
sets the y coordinate of a pin at a certain time

Parameters:
time - actual time (0 is the start of the animation)

kollision_mit_Kugel

public void kollision_mit_Kugel(double kugelspeedX,
                                double kugelspeedY,
                                double kugelaccellerationX,
                                int time,
                                double angleToGo)
sets the time of collison and the speed and the angle of the pin

Parameters:
kugelspeedX - speed of the ball who hits the pin on x-axis
kugelspeedY - speed of the ball who hits the pin on y-axis
kugelaccellerationX - accelleration of the ball on x-axis
time - the actual time (is the time of the collision)
angleToGo - the direction the pin will moves in

if_collisionBall

public void if_collisionBall(Kugel k,
                             int time)
checks if the ball k collides at time time with the pin

Parameters:
k - ball
time - time

if_collisionPin

public void if_collisionPin(Kegel p,
                            int time)
checks if the pin collides with another pin p at time time

Parameters:
p - pin
time - time

angelToBall

public double angelToBall(double kugelspeedX,
                          double kugelspeedY,
                          double kugelaccellerationX,
                          int time)
calculates the actual angle of the ball to the coordinate system

Parameters:
kugelspeedX - speed of the ball in x-axis
kugelspeedY - speed of the ball in y-axis
kugelaccellerationX - accelleration of the ball in x-axis
time - time
Returns:
angle between the actual direction of the ball and the coordinate system

x_transformToNew

public double x_transformToNew(double x,
                               double y,
                               double nX0,
                               double nY0,
                               double angle)
does a coordinate transformation (X)

Parameters:
x - x coordinate in the old system
y - y coordinate in the old system
nX0 - the x coordinate in the old system of the 0-point of the new system
nY0 - the y coordinate in the old system of the 0-point of the new system
angle - the angle between the old axis and the new ones
Returns:
x' coordinate in the new System

y_transformToNew

public double y_transformToNew(double x,
                               double y,
                               double nX0,
                               double nY0,
                               double angle)
does a coordinate transformation (Y)

Parameters:
x - x coordinate in the old system
y - y coordinate in the old system
nX0 - the x coordinate in the old system of the 0-point of the new system
nY0 - the y coordinate in the old system of the 0-point of the new system
angle - the angle between the old axis and the new ones
Returns:
y' coordinate in the new System

reset

public void reset()
resets the pin to his start-values


reset2

public void reset2()
sets the pin as hit and to a position outside the shown area, so he will not appear on the screen


doPaint

public void doPaint(java.awt.Graphics g,
                    java.awt.Image i4,
                    java.awt.Image i3,
                    java.awt.Image i2,
                    java.awt.Image i1,
                    java.awt.Image i0)
paints a graphic of the pin

Parameters:
g - Graphics instance on witch it should be painted
i4 - image of certain position of the pin
i3 - image of certain position of the pin
i2 - image of certain position of the pin
i1 - image of certain position of the pin
i0 - image of certain position of the pin


Code:                        AnimationPaint.java  ComputeAnimation.java  Delle.java  Ground.java  Kegel.java  Kugel.java  Window.java

All Classes All Classes
AnimationPaint
ComputeAnimation
Delle
Ground
Kegel
Kugel
Window

Javadoc:

© 2007 Biber & PhiSch