|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Canvas
gpl.gasteroids.GasteroidsCanvas
public class GasteroidsCanvas
GasteroidsCanvas implementa la clase en la que tiene lugar la acción del juego.
Field Summary |
---|
Fields inherited from class javax.microedition.lcdui.Canvas |
---|
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
Constructor Summary | |
---|---|
GasteroidsCanvas()
Constructor que inicializa el juego. |
Method Summary | |
---|---|
java.util.Vector |
getParticles(int n)
Retorna un array con n partículas |
SpaceShip |
getShip()
Crea una nueva nave que está parada en el centro de la pantalla |
void |
run()
Método que ejecuta la hebra encargada de actualizar la simulación. |
void |
updateParticles()
Actualiza las condiciones de las partículas. |
void |
updateShip()
Actualiza la situación de la nave (posición y velocidad) |
Methods inherited from class javax.microedition.lcdui.Canvas |
---|
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints, setFullScreenMode |
Methods inherited from class javax.microedition.lcdui.Displayable |
---|
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GasteroidsCanvas()
Básicamente:
Method Detail |
---|
public void run()
La simulación da saltos en el tiempo de valor QUANTUM.
En cada salto:
run
in interface java.lang.Runnable
public void updateParticles()
public void updateShip()
public java.util.Vector getParticles(int n)
n
- Número de partículas a devolver
Vector
con las partículas creadaspublic SpaceShip getShip()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |