1.4源程序
1.4.1 BigMouthFish.java
package cn.ycit.xinxi.eatbean.fish;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
public class BigMouseFish implements ActionListener {
public static int up = 0;
public static int right = 1;
public static int down = 2;
public static int left = 3;
public int size = 50;
public int direction = right;
public Color color = Color.CYAN;
public int posx = 80;
public int posy = 80;
public int speed = 4;
public int eyesize = size / 5;
public int eyeposx = posx + size / 2;
public int eyeposy = posy + size / 5;
private Color eyecolor = Color.BLACK;
private int maxMouse = 30;
private int mousesize = 30;
private boolean isOpen = true;
private Timer time = null;
/**
* 创建一个位置为(200,200)大小为50,方向右,颜色蓝色,速度为10* */
public BigMouseFish() {
this(200,200,50,right,Color.CYAN,10);
}
public BigMouseFish(int posx, int posy, int size, int direction,Color color, int speed) { this.posx = posx;
this.posy = posy;
this.size = size;
this.speed = speed;