forked from udohi/GameArena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRain.java
35 lines (30 loc) · 763 Bytes
/
Rain.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.util.Random;
public class Rain
{
public static Random rand = new Random();
public static String col = "BLUE";
public static Rectangle[] array;
// TERRIBLE CLASS - REDO
public Rain(Cloud cloud, GameArena arena)
{
array = new Rectangle[3];
if (rand.nextBoolean())
col = "CYAN";
array[0] = new Rectangle(cloud.x - 10, cloud.y, 3, 8, col);
if (rand.nextBoolean())
col = "CYAN";
array[1] = new Rectangle(cloud.x, cloud.y, 3, 9, col);
if (rand.nextBoolean())
col = "CYAN";
array[2] = new Rectangle(cloud.x + 10, cloud.y, 3, 9, col);
for (int i = 0; i < 3; i++)
arena.addRectangle(array[i]);
}
public void move()
{
for (int i = 0; i < 3; i++)
{
array[i].setYPosition(array[i].getYPosition() + 5);
}
}
}