AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.entities.Wall Class Reference
Inheritance diagram for game2dai.entities.Wall:

Public Member Functions

 Wall (Vector2D start, Vector2D end, boolean visible)
 
 Wall (String name, Vector2D start, Vector2D end, boolean visible)
 
Vector2D getStartPos ()
 
Vector2D getEndPos ()
 
Vector2D norm ()
 
boolean isEitherSide (double x0, double y0, double x1, double y1)
 
boolean isInDomain (Domain view)
 
boolean isOver (double px, double py)
 
- Public Member Functions inherited from game2dai.entities.BaseEntity
 BaseEntity ()
 
 BaseEntity (String name)
 
 BaseEntity (String entityName, Vector2D entityPos, double entityColRadius)
 
int ID ()
 
void updateFSM (double deltaTime, World world)
 
FiniteStateMachine FSM ()
 
boolean hasFSM ()
 
void addFSM ()
 
boolean removeFSM ()
 
int Z ()
 
BaseEntity Z (int z)
 
boolean isVisible ()
 
BaseEntity visible (boolean visible)
 
double colRadius ()
 
BaseEntity colRadius (double colRadius)
 
boolean isOverLapAllowed ()
 
BaseEntity overLapAllowed (boolean overLapAllowed)
 
boolean isInDomain (Domain view)
 
boolean isOver (double px, double py)
 
BaseEntity renderer (Picture renderer)
 
Picture renderer ()
 
void die (World world, double timeToLive)
 
void born (World world, double timeToLive)
 
BaseEntity moveTo (double x, double y)
 
BaseEntity moveTo (Vector2D p)
 
BaseEntity moveBy (double x, double y)
 
BaseEntity moveBy (Vector2D p)
 
Vector2D pos ()
 
BaseEntity name (String name)
 
String name ()
 
boolean isEitherSide (double x0, double y0, double x1, double y1)
 
boolean isEitherSide (Vector2D p0, Vector2D p1)
 
void update (double deltaTime, World world)
 
void draw (World world)
 
void draw (double elapsedTime, World world)
 
int compareTo (BaseEntity o)
 
String toString ()
 

Package Attributes

Vector2D end = new Vector2D()
 
Vector2D wallNorm
 
- Package Attributes inherited from game2dai.entities.BaseEntity
boolean overlapAllowed = false
 

Additional Inherited Members

- Public Attributes inherited from game2dai.entities.BaseEntity
String tag = ""
 
int tagNo = 0
 
- Protected Attributes inherited from game2dai.entities.BaseEntity
Integer entityID
 
String name = ""
 
Picture renderer = null
 
boolean visible = true
 
Vector2D pos = new Vector2D()
 
double colRadius
 

Detailed Description

This class represents a wall.
A wall is used to constrain the movement of Vehicle entities that are using 'wall avoidance' in their steering behaviour. A vehicle will not pass through a wall from the 'outside' but will pass through from the inside (i.e. a one-way wall!).
If you image the wall to be the radius of a circle with the wall start position at the centre and the end position on the circumference, then the clockwise side is considered to be the 'outside' and the anti-clockwise side the 'inside'. So be careful which way you define the wall end-points.

Author
Peter Lager

Constructor & Destructor Documentation

◆ Wall() [1/2]

game2dai.entities.Wall.Wall ( Vector2D  start,
Vector2D  end,
boolean  visible 
)

Create a wall.

Parameters
startwall start position.
endwall end position
visiblewhether the wall is visible

◆ Wall() [2/2]

game2dai.entities.Wall.Wall ( String  name,
Vector2D  start,
Vector2D  end,
boolean  visible 
)

Create a 'named' wall.

Parameters
namethe name you want to give this entity
startwall start position.
endwall end position
visiblewhether the wall is visible

Member Function Documentation

◆ getEndPos()

Vector2D game2dai.entities.Wall.getEndPos ( )

Get the world end position

◆ getStartPos()

Vector2D game2dai.entities.Wall.getStartPos ( )

Get the wall start position

◆ isEitherSide()

boolean game2dai.entities.Wall.isEitherSide ( double  x0,
double  y0,
double  x1,
double  y1 
)

Determines whether the two points given are 'either side of the object' if true then the two positions are not visible to each other.

Parameters
x0first point x position
y0first point y position
x1second point x position
y1second point y position
Returns
true if the points are on opposites sides of the wall

Reimplemented from game2dai.entities.BaseEntity.

◆ isInDomain()

boolean game2dai.entities.Wall.isInDomain ( Domain  view)

Determine whether this entity is inside or part inside the domain. This method is used by the world draw method to see if this entity should be drawn.

Parameters
viewthe world domain
Returns
true if any part of this entity is inside the domain

Reimplemented from game2dai.entities.BaseEntity.

◆ isOver()

boolean game2dai.entities.Wall.isOver ( double  px,
double  py 
)

Since the wall is considered to have no thickness then the world point cannot be over the wall. So this always returns false;

Reimplemented from game2dai.entities.BaseEntity.

◆ norm()

Vector2D game2dai.entities.Wall.norm ( )

Get the wall normal - it will point 'outside'

Returns
the wall normal (always in normalised form)

The documentation for this class was generated from the following file: