public class Obstacle extends BaseEntity
BaseEntity.DepthOrder
tag, tagNo
Constructor and Description |
---|
Obstacle(java.lang.String name,
Vector2D pos,
double colRadius)
Create an obstacle with a name
|
Obstacle(Vector2D pos,
double colRadius)
Create an obstacle without a name
|
Modifier and Type | Method and Description |
---|---|
boolean |
isEitherSide(double x0,
double y0,
double x1,
double y1)
Determines whether two points are either side of this obstacle.
|
boolean |
isInDomain(Domain view)
Determine whether this obstacle is inside or part inside the domain.
|
boolean |
isOver(double px,
double py)
Determine whether the given world position is over this obstacle.
|
static Obstacle[] |
makeFromXML(java.io.File xmlFile)
Alternative if not using Processing
|
static Obstacle[] |
makeFromXML(processing.core.PApplet app,
java.lang.String xmlFilename)
This is the one to use with Processing
|
static Obstacle[] |
makeFromXML(java.lang.String xmlFilename)
Alternative if not using Processing
|
java.lang.String |
toString()
Entity ID number and name returned as a String
|
addFSM, born, colRadius, colRadius, compareTo, die, draw, draw, FSM, hasFSM, ID, isEitherSide, isOverLapAllowed, isVisible, moveBy, moveBy, moveTo, moveTo, name, name, overLapAllowed, pos, removeFSM, renderer, renderer, update, updateFSM, visible, Z, Z
public Obstacle(java.lang.String name, Vector2D pos, double colRadius)
name
- optional name for this obstaclepos
- world position of obstacle centrecolRadius
- collision radiuspublic Obstacle(Vector2D pos, double colRadius)
pos
- world position of obstacle centrecolRadius
- collision radiuspublic static Obstacle[] makeFromXML(processing.core.PApplet app, java.lang.String xmlFilename)
app
- xmlFilename
- public static Obstacle[] makeFromXML(java.lang.String xmlFilename)
xmlFilename
- name of the file to parsepublic static Obstacle[] makeFromXML(java.io.File xmlFile)
xmlFile
- File to parsepublic boolean isEitherSide(double x0, double y0, double x1, double y1)
isEitherSide
in class BaseEntity
x0
- x position of first point of interesty0
- y position of first point of interestx1
- x position of second point of interesty1
- y position of second point of interestpublic boolean isInDomain(Domain view)
isInDomain
in class BaseEntity
view
- the world domainpublic boolean isOver(double px, double py)
isOver
in class BaseEntity
px
- x position for point of interestpy
- y position for point of interestpublic java.lang.String toString()
BaseEntity
toString
in class BaseEntity
Processing library AI_for_2D_Games by Peter Lager. (C) 2013