首页>代码>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);
       }
}
最近下载更多
你说捕鱼王子请上车  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日
最代码-宋家辉  LV61 2023年2月28日
hkxyyz  LV6 2023年2月28日
hrbylw  LV8 2022年9月16日
微信网友_5852742079762432  LV6 2022年4月11日
最近浏览更多
wjk0712 2023年12月22日
暂无贡献等级
huangzy  LV12 2023年12月5日
Stormwuhu 2023年12月1日
暂无贡献等级
你说捕鱼王子请上车  LV1 2023年11月16日
lyws1986  LV17 2023年11月14日
联轴器 2023年10月21日
暂无贡献等级
wangjialiang1  LV17 2023年8月24日
yerwiu  LV10 2023年8月13日
周华贵  LV3 2023年8月2日
24464654 2023年6月25日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友