モグラクラスの動作検証リスト1
// モグラクラス
//
class MoguraBody implements TimerListener {
public final int DEFAULT_TIME=2000; // 2秒間出現する
public final int DEFAULT_BUSY=8; // 8回に1回出現する
static Random rnd = new Random();
protected MoguraListener moguralisten = null;
protected ImageLabel moguraimage;
protected Timer timer;
protected Image [] img;
protected boolean flagVisible = false;
protected int busy;
protected int time;
protected int timeresolution;
protected int score;
protected int miss;
protected Image blank;
// コンストラクタ
MoguraBody( Image [] image )
throws Exception {
// 絵が0個ではモグラは成立しない
if( image.length == 0 ) {
throw new IllegalArgumentException("Error");
}
// 空の絵をロードする
MediaImage mi = MediaManager.getImage("resource:///blank.gif");
try {
mi.use();
}
catch(Exception e) {
throw e;
}
blank = mi.getImage();
// モグラの絵を保存 // 配列の代入ができないVMがあるらしい
img = new Image[image.length];
for(int i=0 ; i
モバイルショップ
FEED BACK |