//
// CHAPTER 27
// Class Source Name [MoverOctopus.java]
// Package name [userClass.App]
// 1996.3
// Author [ Junzo hagimoto ]
package userClass.App;
import java.applet.*;
import java.awt.*;
import userClass.App.*;
public class MoverOctopus extends Mover {
//
// Moverの表示。
//
public void drawImage(Graphics g){
if( hitTimer ==0 ){
g.drawImage(owner.img[imgCount++/4 ],x,y,owner.a);
if(imgCount / 4 == 3 ){
imgCount = 0;
}
}else{
g.drawImage(owner.img[(hitTimer/2) % owner.maxImage ],save_x,save_y,owner.a);
}
}
//
// Moverの次の表示座標を計算する。
//
public void calcxy(Dimension d,int speed){
if( x > d.width - getImageWidth(0) ){
x = d.width - getImageWidth(0) -1;
x_Plus = -1 ;
}
if( x < 0 ){
x = 0;
x_Plus = 1 ;
}
if( y > d.height - getImageHeight(0) ){
y = d.height - getImageHeight(0)-1 ;
y_Plus = -1;
}
if( y < 0 ){
y =1;
y_Plus = 1;
}
y += 2 * y_Plus + (int)(Math.random() * 6) - 3;
x += 2 * x_Plus + (int)(Math.random() * 6) - 3;
}
}
//