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

Public Member Functions

 Obstacle (String name, Vector2D pos, double colRadius)
 
 Obstacle (Vector2D pos, double colRadius)
 
boolean isEitherSide (double x0, double y0, double x1, double y1)
 
boolean isInDomain (Domain view)
 
boolean isOver (double px, double py)
 
String toString ()
 
- 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 ()
 

Static Public Member Functions

static Obstacle[] makeFromXML (PApplet app, String xmlFilename)
 
static Obstacle[] makeFromXML (String xmlFilename)
 
static Obstacle[] makeFromXML (File xmlFile)
 

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
 
- Package Attributes inherited from game2dai.entities.BaseEntity
boolean overlapAllowed = false
 

Detailed Description

This class represents a circular obstacle. The user must ensure that the collision radius and the obstacles renderer size are appropriately matched.

Author
Peter Lager

Constructor & Destructor Documentation

◆ Obstacle() [1/2]

game2dai.entities.Obstacle.Obstacle ( String  name,
Vector2D  pos,
double  colRadius 
)

Create an obstacle with a name

Parameters
nameoptional name for this obstacle
posworld position of obstacle centre
colRadiuscollision radius

◆ Obstacle() [2/2]

game2dai.entities.Obstacle.Obstacle ( Vector2D  pos,
double  colRadius 
)

Create an obstacle without a name

Parameters
posworld position of obstacle centre
colRadiuscollision radius

Member Function Documentation

◆ isEitherSide()

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

Determines whether two points are either side of this obstacle. If they are then they cannot 'see' each other.

Parameters
x0x position of first point of interest
y0y position of first point of interest
x1x position of second point of interest
y1y position of second point of interest
Returns
true if the points are either side else false

Reimplemented from game2dai.entities.BaseEntity.

◆ isInDomain()

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

Determine whether this obstacle 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.Obstacle.isOver ( double  px,
double  py 
)

Determine whether the given world position is over this obstacle.

Parameters
pxx position for point of interest
pyy position for point of interest
Returns
true if over the obstacle

Reimplemented from game2dai.entities.BaseEntity.

◆ makeFromXML() [1/3]

static Obstacle[] game2dai.entities.Obstacle.makeFromXML ( File  xmlFile)
static

Alternative if not using Processing

Parameters
xmlFileFile to parse
Returns
an array of Obstacles

◆ makeFromXML() [2/3]

static Obstacle[] game2dai.entities.Obstacle.makeFromXML ( PApplet  app,
String  xmlFilename 
)
static

This is the one to use with Processing

Parameters
app
xmlFilename
Returns
an array of Obstacles

◆ makeFromXML() [3/3]

static Obstacle[] game2dai.entities.Obstacle.makeFromXML ( String  xmlFilename)
static

Alternative if not using Processing

Parameters
xmlFilenamename of the file to parse
Returns
an array of Obstacles

◆ toString()

String game2dai.entities.Obstacle.toString ( )

Entity ID number and name returned as a String

Reimplemented from game2dai.entities.BaseEntity.


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