|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.threecoffee.util.Gravity
public class Gravity
Simple class to imitate the action of Gravity.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Gravity(Sprite s,
double bounce)
Sets gravity on the given Sprite. |
Method Summary | |
---|---|
void |
bounce()
Bounces the Sprite vertically. |
double |
getAcceleration()
Returns the acceleration of the Sprite due to gravity. |
double |
getBounce()
Returns the fraction of energy maintained after every bounce. |
long |
getDelay()
Returns the time difference in ms between successive Gravity updates. |
double |
getVel()
Returns the velocity of the Sprite due to gravity. |
boolean |
isPaused()
Returns true if this Gravity object is paused. |
void |
pause(boolean b)
Pauses this Gravity object. |
void |
run()
Called by the System internally. |
void |
setAcceleration(double a)
Sets the vertical acceleration of the Sprite due to this Gravity object. |
void |
setBounce(double b)
Sets the fraction of energy maintained after every bounce. |
void |
setDelay(long d)
Sets the time difference in ms between successive Gravity updates. |
void |
setVel(double v)
Sets the vertical velocity of the Sprite controlled by this Gravity object. |
void |
toggleGravity()
Used by the System internally. |
void |
update()
Called in every iteration of the Gravity loop. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Gravity(Sprite s, double bounce)
bounce
- A value typically between 0 and 1.Method Detail |
---|
public void setDelay(long d)
public long getDelay()
public double getBounce()
public void setBounce(double b)
public double getVel()
public void setVel(double v)
public void setAcceleration(double a)
public double getAcceleration()
public final void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void update()
public void bounce()
public void pause(boolean b)
public boolean isPaused()
public void toggleGravity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |