|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsource.ucregents.playground.physics.BaseEntity
source.ucregents.playground.physics.MovingEntity
public class MovingEntity
This class extends base entity by added properties that allow the object to function in a 2d physics environment
Constructor Summary | |
---|---|
MovingEntity()
The default constructor uses no parameters and sets mass to one |
|
MovingEntity(double x,
double y,
double dX,
double dY)
Constructs a moving entity with 30 width and 30 height, mass 1 and no friction |
|
MovingEntity(double x,
double y,
double width,
double height,
double dX,
double dY)
|
|
MovingEntity(double x,
double y,
double width,
double height,
float orientation,
javax.vecmath.Vector2d initialVelocity,
float inputMass)
The main constructor for Moving entity, gives the entity the following properties |
|
MovingEntity(java.awt.geom.Point2D.Double p,
javax.vecmath.Vector2d v)
Constructor that accepts position and velocity vectors |
|
MovingEntity(PolygonOrCircle shape)
|
|
MovingEntity(PolygonOrCircle shape,
float orientation,
javax.vecmath.Vector2d initialVelocity,
float inputMass)
The main constructor for Moving entity, gives the entity the following properties |
Method Summary | |
---|---|
void |
collide(BaseEntity obj2)
Uses standard billard physics to change the velocities of the moving after the collision has occured. |
void |
collide(MovingEntity obj2)
Uses standard billard physics to change the velocities of the entities after the collision has occured. |
protected java.lang.String |
DefaultImageLocation()
Provides the location of the default image |
void |
Deserialize(CustomXMLReader reader)
|
void |
Draw(java.awt.Graphics2D g2d,
boolean verbose)
Draws the entity |
double |
getAngularVelocity()
Gets the angular Velocity |
javax.vecmath.Vector2d |
getCurrentTickVelocity()
Returns the velocity as measured in current tick times, not seconds |
javax.vecmath.Vector2d |
getCurrentVelocity()
Accessor for the current velocity of the entity |
double |
getMass()
Accessor method for the entity's mass |
void |
increaseVelocity(javax.vecmath.Vector2d velocity)
Increases the velocity by the given value |
void |
increaseXVelocity(double x)
Increases the velocity in the x direction |
void |
increaseYVelocity(double y)
Increases the velocity in the y direction |
boolean |
isStationary()
Gets whether the entity is stationary or not |
boolean |
isUnstoppableForce()
Tells whether the entity is user an Unstoppable Force. |
void |
moveCurrentVelocity()
This moves the entity a fraction of its velocity according to the current tick period length. |
void |
moveVector(javax.vecmath.Vector2d toMove)
Moves the entity a vector, there is no overlap checking with other entities |
void |
Serialize(CustomXMLWriter writer)
|
void |
setAngularVelocity(double angularVel)
Sets the angular velocity |
void |
setCurrentTickVelocity(javax.vecmath.Vector2d input)
Sets the current velocity by being given a tick velocity |
void |
setCurrentVelocity(javax.vecmath.Vector2d velocity)
Mutator for the current velocity of the entity |
void |
setMass(double newMass)
Mutator for the entity's mass |
void |
setStationary(boolean stationary)
Sets whether the entity is stationary or not |
void |
setUnstoppableForce(boolean uf)
Sets if the entity is an Unstoppable Force |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MovingEntity()
public MovingEntity(double x, double y, double dX, double dY)
x
- The x coordinatey
- The y coordinatedX
- The initial X velocitydY
- The initial Y velocitypublic MovingEntity(double x, double y, double width, double height, double dX, double dY)
public MovingEntity(double x, double y, double width, double height, float orientation, javax.vecmath.Vector2d initialVelocity, float inputMass)
x
- The x coordinatey
- The y coordinatewidth
- The width of the entityheight
- The height of the entityorientation
- The orientation of the entityinitialVelocity
- The initial velocity of the entityinputMass
- The mass of the entitypublic MovingEntity(java.awt.geom.Point2D.Double p, javax.vecmath.Vector2d v)
p
- The UL point of the entityv
- The velocity vectorpublic MovingEntity(PolygonOrCircle shape)
public MovingEntity(PolygonOrCircle shape, float orientation, javax.vecmath.Vector2d initialVelocity, float inputMass)
shape
- The Shape of the entityorientation
- The orientation of the entityinitialVelocity
- The initial velocity of the entityinputMass
- The mass of the entityMethod Detail |
---|
public void collide(BaseEntity obj2)
obj2
- The base entity that the calling entity has collided withpublic void collide(MovingEntity obj2)
obj2
- The moving entity that the calling entity has collided withprotected java.lang.String DefaultImageLocation()
BaseEntity
DefaultImageLocation
in class BaseEntity
public void Deserialize(CustomXMLReader reader)
Deserialize
in class BaseEntity
public void Draw(java.awt.Graphics2D g2d, boolean verbose)
Draw
in class BaseEntity
g2d
- The java.awt.Graphics2D objectpublic double getAngularVelocity()
public javax.vecmath.Vector2d getCurrentTickVelocity()
public javax.vecmath.Vector2d getCurrentVelocity()
public double getMass()
public void increaseVelocity(javax.vecmath.Vector2d velocity)
velocity
- The vector to increase the velocity bypublic void increaseXVelocity(double x)
x
- The x component to increase bypublic void increaseYVelocity(double y)
y
- The y component to increase bypublic final boolean isStationary()
public boolean isUnstoppableForce()
public void moveCurrentVelocity()
public void moveVector(javax.vecmath.Vector2d toMove)
toMove
- the vector to move the entitypublic void Serialize(CustomXMLWriter writer)
Serialize
in class BaseEntity
public void setAngularVelocity(double angularVel)
angularVel
- the new angular velocitypublic void setCurrentTickVelocity(javax.vecmath.Vector2d input)
input
- The Velocity vector per tickpublic void setCurrentVelocity(javax.vecmath.Vector2d velocity)
velocity
- The new velocity of the entitypublic void setMass(double newMass)
newMass
- The entities new mass valuepublic final void setStationary(boolean stationary)
stationary
- If it is stationarypublic void setUnstoppableForce(boolean uf)
uf
- Sets if the entity is an Unstoppable Force
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |