|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectActor
QuantumObject
public class QuantumObject
Anything that can move around in space and interact (fluctuate, collide, "hit") with other quantum objects. All moving objects in this game have classes derived from QuantumObject. Unlike in real physics, QuantumObjects have an intrinsic speed that causes them to move around (implemented in act()). They may choose to fall off the screen when reaching the border. Special coding magic enables it to have real dynamic method dispatch so that collisions with different classes of quantum objects can be implemented.
| Field Summary | |
|---|---|
protected boolean |
destroysOnNextTurn
Can be set to us by any caller within a given game turn. |
protected boolean |
disappear
Whether the quantum object should fall off the world (i. |
protected Vector |
mantissa
Contains the mantissa that remains from speed calculations (since Greenfoot only allows it to do pixel-based movements). |
protected Vector |
speed
|
| Constructor Summary | |
|---|---|
QuantumObject()
|
|
| Method Summary | |
|---|---|
void |
act()
A day in the life of a quantum object: 1. |
boolean |
getDestroysOnNextTurn()
|
Vector |
getSpeed()
|
boolean |
hit(Actor actor)
hit. |
void |
move()
move. |
void |
setDestroysOnNextTurn(boolean destroys)
|
void |
setSpeed(Vector someSpeed)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Vector speed
protected Vector mantissa
move()protected boolean disappear
protected boolean destroysOnNextTurn
| Constructor Detail |
|---|
public QuantumObject()
| Method Detail |
|---|
public void act()
public void setSpeed(Vector someSpeed)
public Vector getSpeed()
public void setDestroysOnNextTurn(boolean destroys)
public boolean getDestroysOnNextTurn()
public void move()
mantissapublic boolean hit(Actor actor)
actor - The object we are interacting with
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||