首页>代码>java Swing模拟下雪雪花飞舞堆积效果>/Snow/src/com/zhcpt/day02/game/Snow.java
package com.zhcpt.day02.game;

import java.awt.Image;
import java.util.Random;

import javax.swing.ImageIcon;

public class Snow {
	int x,y;
	int speed;
	int size;
	Image img;
	
	public Snow() {
		size = 30;
		Random random = new Random();
		x = random.nextInt(800-size);
		y = random.nextInt(30)+15;
		speed = random.nextInt(5)+1;
		img = new ImageIcon("image/snow.png").getImage();
	}
	@Override
	public String toString() {
		return "Snow [x=" + x + ", y=" + y + ", speed=" + speed + ", size="
				+ size + ", img=" + img + "]";
	}
	public void down() {
		y+=speed;
	}
	
}
最近下载更多
Cold_sangs  LV3 2022年6月6日
543666826  LV33 2022年3月12日
qsyqa0  LV6 2021年9月4日
1234567zz  LV7 2020年8月13日
new_docker  LV15 2020年7月27日
最代码官方  LV167 2020年7月19日
最近浏览更多
11111444 2022年12月3日
暂无贡献等级
微信网友_6191697646571520  LV6 2022年11月23日
暂无贡献等级
sqee121  LV1 2022年9月4日
lcy111  LV5 2022年9月1日
Cold_sangs  LV3 2022年6月6日
liys1234  LV9 2022年4月22日
3188681084  LV1 2022年3月24日
543666826  LV33 2022年3月12日
xp95323  LV14 2022年1月25日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友