parent
b844d9cf6d
commit
09ae80f7ce
@ -0,0 +1,35 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue