|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.game.JVirus.ActionControl
this class controls the movement of the avatar and the animating thread.
Inner Class Summary | |
protected class |
ActionControl.ActionControlRunner
Animating thread |
static interface |
ActionControl.IGameListener
callback interface for game events |
Field Summary | |
protected Avatar |
avatar
reference to the Avatar |
protected Display |
display
reference to the display |
protected ActionControl.IGameListener |
gameListener
callback function |
protected boolean |
gamePaused
game paused or not |
protected boolean |
gameStart
game running or not |
protected long |
lastTimeAvatarMove
need to escape from stones |
protected Matrix |
level
reference to the level |
protected javax.swing.JFrame |
parent
reference to the JVirusFrame |
protected ActionControl.ActionControlRunner |
runner
thread to for animated objects |
protected int |
set_byte
clear byte |
Fields inherited from interface org.game.JVirus.IFields |
AMD, AT_ACTION, AT_ANIM, AT_BEAM, AT_EAT, AT_EAT_SOUND1, AT_EAT_SOUND2, AT_END, AT_FAll, AT_HOLD, AT_MOVE, AT_PUSH, AT_WALL, BEAM0, BEAM1, BEAM2, BEAM3, BEAM4, BEAM5, BEAM6, BEAM7, BEAM8, BEAM9, BEOS, BLUEGATE, BLUEKEY, DATA1, DATA2, DATA3, DYNS1, DYNS2, DYNS3, DYNS4, DYNT1, DYNT2, DYNT3, DYNT4, EMPTY, END, GREENGATE, GREENKEY, INTEL, LIFE, LINUX, MAC, NOTHING, REDGATE, REDKEY, START, STONE, TREASURE, UNIX, WALL1, WALL2, WALL3, WALL4, WALL5, WINDOWS |
Constructor Summary | |
ActionControl(Display display,
javax.swing.JFrame parent,
ActionControl.IGameListener gameListener)
creates the ActionControl. |
Method Summary | |
protected boolean |
actionAvatar(int sx,
int sy,
int tx,
int ty)
select what Action to do in this field |
protected void |
beamAvatar(char key,
int x,
int y)
search for other beam field and move the avatar |
protected void |
gameOver(int reason)
edit the avatar and call the callback funktion |
Avatar |
getAvatar()
return the current avatar |
boolean |
isPaused()
is the game paused or not |
boolean |
isRunning()
is the game started or not |
void |
keyPressed(java.awt.event.KeyEvent e)
get the key events |
void |
keyReleased(java.awt.event.KeyEvent e)
not used |
void |
keyTyped(java.awt.event.KeyEvent e)
not used |
protected void |
moveAvatar(int sx,
int sy,
int tx,
int ty)
next move from user |
protected void |
nextMove()
next move from thread |
void |
pauseGame(boolean b)
pause the game |
protected void |
removeGate(char key)
search for the gate that pass and remove that |
void |
resetAvatar()
reset the scores and lifes of the avatar. |
void |
startGame(Matrix level)
start the game |
void |
stopGame()
stop the game |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Matrix level
Matrix
protected Display display
Display
protected javax.swing.JFrame parent
JVirusFrame
protected Avatar avatar
Avatar
protected ActionControl.IGameListener gameListener
protected ActionControl.ActionControlRunner runner
protected int set_byte
nextMove()
protected boolean gameStart
protected boolean gamePaused
protected long lastTimeAvatarMove
nextMove()
Constructor Detail |
public ActionControl(Display display, javax.swing.JFrame parent, ActionControl.IGameListener gameListener)
display
- reference to the Displayparent
- reference to the JVirusFramegameListener
- reference to the callback functionMethod Detail |
public Avatar getAvatar()
Avatar
public void startGame(Matrix level)
level
- playing levelpublic void pauseGame(boolean b)
b
- pause or notpublic void resetAvatar()
public void stopGame()
public boolean isRunning()
public boolean isPaused()
protected void gameOver(int reason)
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
protected void nextMove()
protected void moveAvatar(int sx, int sy, int tx, int ty)
protected boolean actionAvatar(int sx, int sy, int tx, int ty)
protected void removeGate(char key)
protected void beamAvatar(char key, int x, int y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |