📄 canvasjuego.java
字号:
/*
GAEM - Graphical Adventure Engine for Mobiles (version 0.1)
Copyright (C) 2005 Victor Borrull
This file is part of GAEM.
GAEM is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GAEM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program;
if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import javax.microedition.rms.*;
import java.util.Timer;
/** Es la clase principal, hija de GameCanvas y con interfaz Runnable. A parte de todos los atributos y m閠odos heredados de GameCanvas,
* esta clase realiza las siguiente funciones:
* <p>- Contiene el loop principal del juego.<br>
* - Desde esta clase se crean el inventario, el animador, la gesti髇 de frases, el personaje, el puntero, y todos los objetos.<br>
* - Lee e interpreta los ficheros .dat con la informaci髇 de los niveles y sus mapas.<br>
* - Crea el escenario.<br>
* - Crea la lista de objetos a partir de esa informaci髇.<br>
* - Comprueba si hay algun RecordStore con el nombre del mapa a cargar y el numero de partida; si lo hay, modifica los objetos indicados.<br>
* - Busca otro RecordStore con informaci髇 del inventario, y carga esos objetos y los a馻de al inventario en la posici髇 que ocupaban.<br>
* - Cambia el modo de juego.<br>
* - Funci髇 de scroll del escenario.<br>
* - Control de colisiones.<br>
* - Movimiento autom醫ico hasta llegar a objeto de destino.<br>
* - Representaci髇 gr醘ica del inventario.
*/
public class CanvasJuego extends GameCanvas implements Runnable, CommandListener {
/** Imagen del personaje.*/
private Image pje;
/** Imagen con las <i>tiles</i> del terreno.*/
private Image terreno;
/** Establece si el <i>Thread</i> est
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -