You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
711 B
36 lines
711 B
package com;
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
public class Column {
|
|
int x, y;
|
|
int width, height;
|
|
BufferedImage co_image;
|
|
|
|
int gap; // 上下间隙
|
|
int distance; // 水平间隙
|
|
|
|
int min = -(1200 / 2 - 144 / 2);
|
|
int max = 644 - 146 - 144 / 2 - 1200 / 2;
|
|
|
|
public Column() {
|
|
co_image = BirdGame.col_img;
|
|
width = co_image.getWidth();
|
|
// width = (int) (Math.random() * 20 + 150);
|
|
height = co_image.getHeight();
|
|
x = 432;
|
|
y = (int) (Math.random() * (max - min) + min);
|
|
gap = 144; // 144
|
|
distance = 244;
|
|
}
|
|
|
|
public void star() {
|
|
x = x - 1;
|
|
if (x <= -width) { // 柱子越界
|
|
x = 432;
|
|
// 重新随机
|
|
y = (int) (Math.random() * (max - min) + min);
|
|
}
|
|
}
|
|
}
|