首页>代码>java swing开发FlappyBird游戏—仅供娱乐>/FlappyBird/src/com/tarena/bird/Ground.java
package com.tarena.bird;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Ground {
	BufferedImage image;
	
	int x;
	int y;
	int width;
	int height;
	public Ground(int y) throws IOException {
		image = ImageIO.read(getClass().getResource("ground.png"));
		this. y = y;
		width = image.getWidth();
		height = image.getHeight();
		x = 0;
	}
	
	public void step(){
		x--;
		if(x<= -(width-358)){
			x=0;
		}
	}

	public void paint(Graphics g) {
		g.drawImage(image, x, y, null);		
	}
}
最近下载更多
alexcheung  LV3 2022年12月17日
杨少聪  LV5 2021年6月10日
一两天_  LV1 2021年5月27日
675104182  LV14 2020年9月22日
荒唐的羊  LV27 2020年7月1日
java小书童  LV18 2020年6月9日
15966848095  LV22 2020年2月8日
635969151  LV12 2019年12月18日
candice123  LV7 2019年12月11日
qweqweqwe321321233  LV10 2019年11月5日
最近浏览更多
随便取个名字_哈哈  LV27 6月23日
1661950467  LV2 2024年10月12日
ggflqq  LV1 2024年6月25日
鬼屋报道  LV3 2024年6月1日
long123_356  LV8 2024年5月18日
陈小灏  LV18 2023年12月15日
微信网友_6699076084797440  LV7 2023年10月30日
jiemomo  LV12 2023年10月19日
yangxb2  LV10 2023年7月11日
hougui  LV1 2023年6月20日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友