bit_vy[l1] = Math.cos(d) * d1;
bit_l[l1] = (int)(rand.nextDouble() * 100D) + 100;
bit_p[l1] = (int)(rand.nextDouble() * 3D);
bit_c[l1] = j1;
bit_sx[l1] = m_mouseX;
bit_sy[l1] = m_nAppY - 5;
bit_f[l1] = 2;
if(++k1 == bit_max)
break;
}
if(bit_sound1)
sound2.play();
return true;
}
public boolean mouseExit(Event event, int i, int j)
{
m_mouseX = i;
m_mouseY = j;
return true;
}
void rend()
{
boolean flag = false;
boolean flag1 = false;
boolean flag2 = false;
for(int k = 0; kbits; k++)
switch(bit_f[k])
{
default:
break;
case 1: // '\001'
bit_vy[k] += rand.nextDouble() / 50D;
bit_px[k] += bit_vx[k];
bit_py[k] += bit_vy[k];
bit_l[k]--;
if(bit_l[k] == 0 || bit_px[k]0.0D || bit_py[k]0.0D || bit_px[k](double)m_nAppX || bit_py[k](double)(m_nAppY - 3))
{
bit_c[k] = 0xff000000;
bit_f[k] = 0;
} else
if(bit_p[k] == 0)
{
if((int)(rand.nextDouble() * 2D) == 0)
bit_set((int)bit_px[k], (int)bit_py[k], -1);
} else
{
bit_set((int)bit_px[k], (int)bit_py[k], bit_c[k]);
}
break;
case 2: // '\002'
bit_sy[k] -= 5;
if((double)bit_sy[k] = bit_py[k])
{
bit_f[k] = 1;
flag2 = true;
}
if((int)(rand.nextDouble() * 20D) == 0)
{
int i = (int)(rand.nextDouble() * 2D);
int j = (int)(rand.nextDouble() * 5D);
bit_set(bit_sx[k] + i, bit_sy[k] + j, -1);
}
break;
}
if(flag2bit_sound0)
sound1.play();
}
void bit_set(int i, int j, int k)
{
int l = i + j * m_nAppX;
pix0[l] = k;
}
private int m_nAppX;
private int m_nAppY;
private int m_centerX;
private int m_centerY;
private int m_mouseX;
private int m_mouseY;
private int m_sleepTime;
private boolean isError;
private boolean m_isPaintFinished;
boolean isRunning;
boolean isInitialized;
Thread runner;
int pix0[];
MemoryImageSource offImage;
Image dbImg;
int pixls;
int pixls2;
Random rand;
int bits;
double bit_px[];
double bit_py[];
double bit_vx[];
double bit_vy[];
int bit_sx[];
int bit_sy[];
int bit_l[];
int bit_f[];
int bit_p[];
int bit_c[];
int bit_max;
int bit_sound;
int ru;
int rv;
AudioClip sound1;
AudioClip sound2;
}
java烟花程序看不懂,求解释!import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;
public class Fireworks extends Applet implements MouseListener, Runnable {
int x, y;//记录鼠标点击的坐标
int top, point;//好像没用到
public void init() {
x = 0;
y = 0;
setBackground(Color.black);// 设置背景色为黑色
addMouseListener(this);//添加鼠标监听
}
public void paint(Graphics g) {
}
public static void main(String args[]) {
Fireworks applet = new Fireworks();
JFrame frame = new JFrame("TextAreaNew");
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {//右上角的叉
System.exit(0);
}
});
frame.add(applet, BorderLayout.CENTER);
frame.setSize(800, 400);//程序的框框大小
applet.init();
applet.start();
frame.setVisible(true);//
}
public void run() {
// 变量初始化
Graphics g1;
g1 = getGraphics();//这是画笔,得到一个画笔
int y_move, y_click, x_click;
int v;//用于计算等待的时间
x_click = x;
y_click = y;//把点击的坐标保存下来,因为其它线程会去改这两个坐标 。
推荐阅读
- java画有速度的圆代码,java绘制圆形代码
- python怎么判断奇偶并输出,用python判断奇偶
- chatgpt使用图片,chatteing
- 虎牙kpl张大仙直播,张大仙虎牙首播
- php怎么插入数据到表中 php数据表里怎么添加数据
- 不吃甘蔗有什么危害视频,吃甘蔗的禁忌有哪些
- linux追加命令怎么用,linux追加文件内容命令
- 视频号怎么设置不给某人看,视频号如何不让某些人看
- python编写函数代码 python怎么编函数