data
Class Balloon

java.lang.Object
  extended by data.GameEntity
      extended by data.Balloon

public class Balloon
extends GameEntity

Author:
Tansel

Field Summary
private  int size
          Since we have different sizes of balloons, this additional parameter will let us differentiate the balloons from each other.
 
Fields inherited from class data.GameEntity
dx, dy, ge, sm, sprite, x, y
 
Constructor Summary
Balloon(GameEngine ge, java.lang.String file, int x, int y, ScreenManager sm, int size)
          Look for GameEntity
Balloon(GameEngine ge, java.lang.String file, int x, int y, ScreenManager sm, int size, boolean reversedWay)
          Look for GameEntity
 
Method Summary
private  java.awt.Rectangle bottom()
          Same as top method.
 void collidedWith(GameEntity entity)
          This collision method does the necessary processes when collision between an Obstacle and Balloon occurs.
 int getSize()
           
 int getX()
           
 int getY()
           
 void move(long delta)
          This is the overridden method of actual move method.
private  java.awt.Rectangle top()
          This new Rectangle is for checking exact collision between obstacle entity and balloon.
 
Methods inherited from class data.GameEntity
collidesWith, draw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

private int size
Since we have different sizes of balloons, this additional parameter will let us differentiate the balloons from each other.

Constructor Detail

Balloon

public Balloon(GameEngine ge,
               java.lang.String file,
               int x,
               int y,
               ScreenManager sm,
               int size)
Look for GameEntity

Parameters:
ge -
file -
x -
y -
sm -
size -

Balloon

public Balloon(GameEngine ge,
               java.lang.String file,
               int x,
               int y,
               ScreenManager sm,
               int size,
               boolean reversedWay)
Look for GameEntity

Parameters:
ge -
file -
x -
y -
sm -
size -
reversedWay - If the balloon should move other direction when created.
Method Detail

move

public void move(long delta)
This is the overridden method of actual move method. When a balloon reaches to the boundaries of screen it shall bounce back.

Overrides:
move in class GameEntity
Parameters:
delta - is the amount of time that entity will move.

collidedWith

public void collidedWith(GameEntity entity)
This collision method does the necessary processes when collision between an Obstacle and Balloon occurs. Specifically, a balloon will bounce back.

Specified by:
collidedWith in class GameEntity

getX

public int getX()
Overrides:
getX in class GameEntity
Returns:
The x position of the entity.

getY

public int getY()
Overrides:
getY in class GameEntity
Returns:
The y position of the entity.

getSize

public int getSize()

top

private java.awt.Rectangle top()
This new Rectangle is for checking exact collision between obstacle entity and balloon.

Returns:
Top part of the balloon as a new rectangle.

bottom

private java.awt.Rectangle bottom()
Same as top method.

Returns:
Bottom part of the ballon as a new rectangle.