-
Notifications
You must be signed in to change notification settings - Fork 0
/
Block.java
44 lines (32 loc) · 943 Bytes
/
Block.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
36
37
38
39
40
41
42
43
44
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Block here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Block extends Actor
{
public Block()
{
int i = (int)(Math.random()*5+1);
switch(i)
{
case 1:
this.setImage ("Tetris_Block_Cyan.png");
break;
case 2:
this.setImage ("Tetris_Block_Green.png");
break;
case 3:
this.setImage ("Tetris_Block_Grey.png");
break;
case 4:
this.setImage ("Tetris_Block_Red.png");
break;
case 5:
this.setImage ("Tetris_Block_BetterYellow.png");
break;
}
}
}