From f03412f556eba205b5b462e67d61d04ee08c5ae3 Mon Sep 17 00:00:00 2001 From: ppz6le8u7 <3580438051@qq.com> Date: Sun, 25 Jun 2023 15:28:12 +0800 Subject: [PATCH] ADD file via upload --- Ground.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Ground.java diff --git a/Ground.java b/Ground.java new file mode 100644 index 0000000..7bb223f --- /dev/null +++ b/Ground.java @@ -0,0 +1,25 @@ +package com; + +import java.awt.image.BufferedImage; + +public class Ground { + int x, y; + int width, height; + BufferedImage img_ground; // 地面图片 + + public Ground() { + img_ground = BirdGame.ground; + x = 0; + y = BirdGame.bg.getHeight() - img_ground.getHeight(); + width = img_ground.getWidth(); + height = img_ground.getHeight(); + } + + // 地面移动 + public void step() { + x = x - 1; + if (x <= 432 - width) { + x = 0; + } + } +}