|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPort
Class Port implements a gate.
FIXME: (1.1) This should probably be named "Gate".
A gate consists of two buoys floating on the water, left (portboard) and right (starboard).
Contains the anchored positions for each buoy and the moving positions of each buoy. The buoys can move, e.g. when hit by a boat. A buoy that has moved will float back to its anchored position.
Port contains the functionality to test collisions with the players and to test passing the gate. Passing the gate is dependent on the direction.
Vector2,
Track| Field Summary | |
Vector2 |
left
portboard buoy of the port |
private Vector2 |
mount_left
anchoring point of the portboard buoy |
private Vector2 |
mount_right
anchoring point of the starboard buoy |
Vector2 |
right
starboard buoy of the port |
| Constructor Summary | |
Port(Vector2 l,
Vector2 r)
Constructor. |
|
| Method Summary | |
void |
crashWithPlayer(Player p)
Checks the collisions between a player and the gate buoys. |
void |
move(float seconds)
Moves the buoys towards the anchoring position if they aren't there. |
boolean |
passed(Vector2 p1,
Vector2 p2)
Checks if the line segment p1-p2 (the interval traveled by the boat) intersects with this gate while going to the allowed direction. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public Vector2 left
public Vector2 right
private Vector2 mount_left
private Vector2 mount_right
| Constructor Detail |
public Port(Vector2 l,
Vector2 r)
l - position of the portboard buoyr - position of the starboard buoy| Method Detail |
public void move(float seconds)
seconds - time slice according to which the buoys should be
movedpublic void crashWithPlayer(Player p)
If there is a collision, the buoy should be moved.
p - the player to check the collisions with
public boolean passed(Vector2 p1,
Vector2 p2)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||