地面 class Ground BufferedImage image; int x y; int width; int height; public Ground throws Exception image = ImageIOread getClassgetResourcegroundpng; width = imagegetWidth; height = imagegetHei
这段代码定义了一个地面类Ground,它包含了一张地面图片(image),地面的坐标(x,y),以及宽度(width)和高度(height)。在构造器中,通过ImageIO读取了地面图片,并初始化了其宽度和高度。在类体中,定义了一个step()方法,使得地面图片每次向左移动一个像素,当移动到一定距离后,重新回到原点。
原文地址: https://www.cveoy.top/t/topic/g1aY 著作权归作者所有。请勿转载和采集!