Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package world;
- import de.ur.mi.geom.Point;
- import de.ur.mi.util.RandomGenerator;
- import java.util.Random;
- public class Sky {
- public RandomGenerator randomgenerator;
- public Random random;
- public Stars star;
- public void setup() {
- setupApplication();
- createStars();
- }
- public void setupApplication() {
- random = RandomGenerator.getInstance();
- }
- public void draw(){
- drawStars();
- }
- public void drawStars() {
- for (int i = 0; i < Constant.MAX_STARS; i++) {
- if (i%2==0) {
- star.draw();
- }
- }
- }
- public void createStars() {
- star = new Stars(Constant.OBJECT_SIZE, Constant.OBJECT_SIZE, Constant.OBJECT_SIZE, Constant.OBJECT_SIZE, Constant.STAR_PATH,Constant.STAR_DISTANCE);
- }
- public int getNextDiameter() {
- return randomgenerator.nextInt(Constant.MIN_CIRCLE_WIDTH, Constant.MAX_CIRCLE_WIDTH);
- }
- public Point getNextPoint(int diameter) {
- int lowerX = diameter / 2;
- int upperX = Constant.WIDTH - (diameter / 2);
- int lowerY = diameter / 2;
- int upperY = Constant.HEIGHT - (diameter / 2);
- int x = randomgenerator.nextInt(lowerX, upperX);
- int y = randomgenerator.nextInt(lowerY, upperY);
- return new Point(x, y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement