|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.concord.collisions.engine.JWorldElement | +--org.concord.collisions.engine.JDaemon | +--org.concord.collisions.engine.JImpulseDaemon
Force daemon element in the world
A force daemon is a special daemon that affects only atoms when they collide with it.
A force daemon applies a specific force to all atoms that collide with it. An impulse daemon applies a specific impulse to the atom, which is a force that will act on the atom for a certain period of time.
JDaemon
, Serialized FormFields inherited from class org.concord.collisions.engine.JDaemon |
activationSteps, activeColor, collisionHistory, currentActivationStep, DEFAULT_PAINT_RADIUS, doCollisionsHistory, minDistance, timeColor |
Fields inherited from class org.concord.collisions.engine.JWorldElement |
acx, acy, areaListener, areaTables, collSensitive, controllable, DEFAULT_MAX_CONSTRAINT, DEFAULT_MIN_CONSTRAINT, doProjection, draggable, elementListeners, flashing, iconHeight, iconWidth, index, iviewer, mass, name, pressedState, propertyListeners, qtIcon, qtMovie, rectsForListener, scaleIcon, showAcceleration, showVelocity, showVelocityNumber, suggestedCollisionTime, swingIcon, vel_scale, vx, vy, wasLastStepCollision |
Constructor Summary | |
JImpulseDaemon()
|
Method Summary | |
void |
addImpulseForceListener(ImpulseForceListener l)
Add an impulse listener |
void |
applyForce(CCForce f)
JDaemon doesn't support applying forces |
void |
clearForces()
remove all applied forces |
protected void |
convertSingleForceToMultiForcedDaemon()
|
static JImpulseDaemon |
createConstantForceDaemon(float x,
float y,
float width,
float height,
float forceX,
float forceY)
Creates a new constant force daemon |
static JImpulseDaemon |
createImpulseDaemon(float x,
float y,
float width,
float height,
float forceX,
float forceY,
boolean doCorrectInitDelay,
float forceDuration)
|
static JImpulseDaemon |
createImpulseDaemon(float x,
float y,
float width,
float height,
float forceX,
float forceY,
float forceDuration)
Creates a new impulse daemon |
static JImpulseDaemon |
createMultiConstantForceDaemon(float x,
float y,
float width,
float height,
float forceX,
float forceY)
Creates a new constant force daemon with ability to apply many forces |
static JImpulseDaemon |
createMultiImpulseDaemon(float x,
float y,
float width,
float height,
float forceX,
float forceY,
boolean doCorrectInitDelay,
float forceDuration)
|
static JImpulseDaemon |
createMultiImpulseDaemon(float x,
float y,
float width,
float height,
float forceX,
float forceY,
float forceDuration)
Creates a new impulse daemon with ability to apply many forces |
void |
doDrag(CCCoordinateTuner tuner,
int x,
int y)
|
CCDraggable |
findDraggable(float x,
float y)
|
float |
getActTime()
For impulse daemons, gets the duration of the impulse in SECONDS |
float |
getDefaultActTime()
|
int |
getDefaultForceDrawMode()
|
float |
getDefaultInitDelay()
|
protected CCConstantForce |
getFirstForce()
|
CCConstantForce |
getForce()
Returns the force associated with the daemon |
protected CCDraggable |
getForceDraggable(float x,
float y)
|
int |
getForceDrawMode()
|
boolean |
getMakeSound()
For impulse daemons, returns if the daemon will make a sound when it collides with the atom or not. |
float |
getXTemperature()
|
float |
getYTemperature()
|
void |
impulseActivated(ImpulseForceEvent evt)
|
void |
impulseDeactivated(ImpulseForceEvent evt)
|
boolean |
isImpulseDaemon()
Returns if the daemon is an impulse daemon or not. |
boolean |
isPointInside(float px,
float py)
Returns if a specific world coordinates point is inside the element or not |
boolean |
manageCollision(JWorldElement element)
This method is called by JPartWorld when the daemon collides with an element |
boolean |
manageNoCollision(JWorldElement element)
This method is called by JPartWorld every step while the daemon is colliding with an element |
void |
paint(java.awt.Graphics g,
java.awt.Graphics sg)
|
void |
removeImpulseForceListener(ImpulseForceListener l)
Remove an impulse listener |
void |
resetDefaultColors()
Reset default colors for the daemon. |
void |
setActTime(float actTime)
Sets the duration of the impulse in SECONDS |
void |
setForceDragMode(int m)
|
void |
setForceDrawMode(int m)
|
void |
setGeometry(java.lang.Object object)
|
void |
setMakeSound(boolean b)
For impulse daemons, sets if the daemon will make a sound when it collides with the atom or not. |
void |
setProperty(java.lang.String name,
java.lang.Object val)
|
void |
setSoundFileName(java.lang.String filename)
For impulse daemons, sets the sound that the daemon will make when it collides with the atom. |
void |
setWorldModel(JPartWorld world)
Method called by JPartWorld |
void |
startDrag(int x,
int y)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JImpulseDaemon()
Method Detail |
public static JImpulseDaemon createImpulseDaemon(float x, float y, float width, float height, float forceX, float forceY, float forceDuration)
x
- daemon's x coordinatey
- daemon's y coordinatew
- daemon's graphical width (minimum 1)h
- daemon's graphical height (minimum 1)forceX
- x coordinate of the impulse force that will be applied to the atomforceY
- y coordinate of the impulse force that will be applied to the atomforceDuration
- duration of the impulse (in milliseconds)public static JImpulseDaemon createImpulseDaemon(float x, float y, float width, float height, float forceX, float forceY, boolean doCorrectInitDelay, float forceDuration)
public static JImpulseDaemon createConstantForceDaemon(float x, float y, float width, float height, float forceX, float forceY)
x
- daemon's x coordinatey
- daemon's y coordinatew
- daemon's graphical width (minimum 1)h
- daemon's graphical height (minimum 1)forceX
- x coordinate of the force that will be applied to the atomforceY
- y coordinate of the force that will be applied to the atompublic static JImpulseDaemon createMultiImpulseDaemon(float x, float y, float width, float height, float forceX, float forceY, float forceDuration)
x
- daemon's x coordinatey
- daemon's y coordinatew
- daemon's graphical width (minimum 1)h
- daemon's graphical height (minimum 1)forceX
- x coordinate of the impulse force that will be applied to the atomforceY
- y coordinate of the impulse force that will be applied to the atomforceDuration
- duration of the impulse (in milliseconds)public static JImpulseDaemon createMultiImpulseDaemon(float x, float y, float width, float height, float forceX, float forceY, boolean doCorrectInitDelay, float forceDuration)
public static JImpulseDaemon createMultiConstantForceDaemon(float x, float y, float width, float height, float forceX, float forceY)
x
- daemon's x coordinatey
- daemon's y coordinatew
- daemon's graphical width (minimum 1)h
- daemon's graphical height (minimum 1)forceX
- x coordinate of the force that will be applied to the atomforceY
- y coordinate of the force that will be applied to the atompublic void setMakeSound(boolean b)
By default, the impulse daemon will make a motorcycle impulse sound. Applies only for impulse daemoms.
b
- indicates if the daemon wil make a sound or notsetSoundFileName(java.lang.String)
public boolean getMakeSound()
Applies only for impulse daemoms.
public void setSoundFileName(java.lang.String filename)
The daemon will make this sound if it has been set to make sounds.
Applies only for impulse daemoms.
filename
- filename(inside collisions.jar) or URL of the sound filesetMakeSound(boolean)
public void setGeometry(java.lang.Object object) throws java.lang.Exception
setGeometry
in class JWorldElement
public void paint(java.awt.Graphics g, java.awt.Graphics sg)
paint
in class JWorldElement
public float getXTemperature()
getXTemperature
in class JWorldElement
public float getYTemperature()
getYTemperature
in class JWorldElement
public boolean manageCollision(JWorldElement element)
manageCollision
in class JDaemon
element
- element the daemon collided withpublic boolean manageNoCollision(JWorldElement element)
manageNoCollision
in class JDaemon
element
- element the daemon is colliding withpublic void resetDefaultColors()
Sets the default colors for force daemons: Purple for inactive and magenta for active.
public void setWorldModel(JPartWorld world)
setWorldModel
in class JWorldElement
public void startDrag(int x, int y)
startDrag
in class JDaemon
public void doDrag(CCCoordinateTuner tuner, int x, int y)
doDrag
in class JDaemon
public CCConstantForce getForce()
public boolean isPointInside(float px, float py)
isPointInside
in class JDaemon
px
- world x coordinate of the pointpy
- world y coordinate of the pointJDaemon.isPointInside(float, float)
public float getActTime()
Only for impulse daemons. If the daemon is a constant force daemon, it returns zero.
public void setActTime(float actTime)
actTime
- time the impulse will be activated after it is attached to an atom.public void impulseActivated(ImpulseForceEvent evt)
impulseActivated
in interface ImpulseForceListener
public void impulseDeactivated(ImpulseForceEvent evt)
impulseDeactivated
in interface ImpulseForceListener
public void addImpulseForceListener(ImpulseForceListener l)
l
- impulse listener to addpublic void removeImpulseForceListener(ImpulseForceListener l)
l
- impulse listener to removepublic boolean isImpulseDaemon()
It returns false when the daemon is just a constant force daemon
false - if it is a constant force daemon
protected CCConstantForce getFirstForce()
public void clearForces()
JWorldElement
clearForces
in class JWorldElement
public void applyForce(CCForce f)
JDaemon
applyForce
in class JDaemon
org.concord.collisions.engine.JDaemon
CCUnsuppOperationException
- protected void convertSingleForceToMultiForcedDaemon()
public CCDraggable findDraggable(float x, float y)
findDraggable
in class JWorldElement
protected CCDraggable getForceDraggable(float x, float y)
public void setProperty(java.lang.String name, java.lang.Object val)
setProperty
in class JWorldElement
public void setForceDragMode(int m)
public void setForceDrawMode(int m)
public int getForceDrawMode()
public float getDefaultInitDelay()
public float getDefaultActTime()
public int getDefaultForceDrawMode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |