首页>代码>Java Swing开发捕鱼达人小游戏>/FishPro/src/com/zte/FishNet.java
package com.zte;

import java.awt.Graphics;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.ImageIcon;
public class FishNet {
	int x;
	int y;
	int count = 0;
	public boolean isLive = true;
	ImageIcon icon;
	FishPanel panel;
	ArrayList<Fish> catchF = new ArrayList<Fish>();
	public FishNet(int x,int y,ImageIcon icon,FishPanel panel){
		this.panel = panel;
		this.x = x;
		this.y = y;
		this.icon = icon;
	}
  public void graw(){
	  count++;
	  if(count>=5){
		  x = -100;
		  y=-100;
		  isLive = false;
	  }
  }
  //网捕鱼
  public void caFish(){
			for(int j=0;j<panel.fishs.size();j++){
				Fish f = panel.fishs.get(j);
				if(f.x>this.x-(f.imgs[0].getIconWidth()/2)
						+5 && f.x+f.imgs[f.imgNum].getIconWidth()/2<this.x
						+this.icon.getIconWidth()
						 && f.y>this.y-(f.imgs[0].getIconHeight()/2)
						 +5 && f.y+f.imgs[f.imgNum].getIconHeight()/2<this.y
						 +this.icon.getIconHeight()){
					f.hp--;
					 if(f.hp==0){
						 panel.fishs.get(j).isCatch = true; 
						 catchF.add(f);
						// Money m = new Money(f.x,f.y,panel,f);
						// panel.ms.add(m);
						 panel.score+=f.money;
						// new MoneMoveThread(m).start();
					 }
				}
			}
	}
 
     //画网
      public void drawNet(Graphics g) {
           g.drawImage(icon.getImage(), x, y, panel);
       }
}
最近下载更多
Mitsune  LV1 5月26日
dengjing  LV5 2月5日
puppyoo  LV1 2024年7月2日
alpaca007  LV1 2024年6月6日
你说捕鱼王子请上车  LV1 2023年11月17日
lyws1986  LV17 2023年11月14日
wangjialiang1  LV17 2023年8月24日
yerwiu  LV10 2023年8月13日
周华贵  LV3 2023年8月2日
yaojingjedaren  LV1 2023年4月18日
最近浏览更多
Mitsune  LV1 5月26日
long123_356  LV8 5月24日
dengjing  LV5 2月5日
linyintan 2024年11月13日
暂无贡献等级
rs2222 2024年11月12日
暂无贡献等级
1661950467  LV2 2024年10月12日
暂无贡献等级
puppyoo  LV1 2024年7月1日
alpaca007  LV1 2024年6月5日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友