package com.zte; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import javax.swing.ImageIcon; public class Bullet { public int x;// 横坐标 public int y;// 纵坐标 static int xxx = 0; static int yyy = 0; Point p; public ImageIcon img;// 子弹代表的图片 public double roate;// 子弹移动的角度 public FishPanel panel; boolean isLive = true; public Bullet(FishPanel panel) { this.panel = panel; } public void move() throws InterruptedException { y -= 20; // 转换x和y坐标 int yy = Math.round((float) Math.cos(roate) * (p.y - 17 - y)); yyy = p.y - 17 - Math.abs(yy); System.out.println(yyy); int xx = Math.round((float) Math.sin(roate) * (p.y - 17 - y)); xxx = p.x - 10 + xx; System.out.println(xxx); if (yyy<=-10 || xxx <= -10) { isLive = false; panel.bullets.remove(this); } hint(); panel.repaint(); } // 处理击中某条鱼 撒网 public void hint() throws InterruptedException{ for(int i=0;i<panel.fishs.size();i++){ Fish f = panel.fishs.get(i); if(xxx>f.x-img.getIconWidth() && xxx<f.x +f.imgs[f.imgNum].getIconWidth() && y<f.y +f.imgs[f.imgNum].getIconHeight()){ FishNet net = new FishNet(xxx-30, yyy-50, new ImageIcon("images/web.png"),panel); panel.bullets.remove(this);//子弹消失 panel.nets.add(net);//子弹消失后撒网 isLive = false; net.caFish(); /*******************/ Thread.sleep(500);//等2秒之后让网消失 panel.nets.remove(net); } } } public void drawBullet(Graphics g) { Graphics2D gp = (Graphics2D) g.create(); gp.rotate(roate, p.x, p.y); gp.drawImage(this.img.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日

微信网友_7550620088864768 LV1
6月12日
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日
微信网友_7077219745763328
2024年7月12日
暂无贡献等级
puppyoo LV1
2024年7月1日
alpaca007 LV1
2024年6月5日