-
Notifications
You must be signed in to change notification settings - Fork 0
/
MiniDobleAsteroide.java
49 lines (43 loc) · 1.89 KB
/
MiniDobleAsteroide.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
45
46
47
48
import java.awt.Color;
import java.awt.Graphics;
public class MiniDobleAsteroide extends MiniAsteroide {
int SIZE_PIXEL = 1;
MiniDobleAsteroide(int x, int y, int vx, int vy) {
super(x, y, vx, vy);
}
void moure() {
x -= vx;
y -= vy;
}
int[][] colMat = {
{-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1},
{-1,-1,-1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 0, 1,-1,-1,-1},
{-1,-1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 0, 1, 1, 1,-1,-1},
{-1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1,-1},
{ 2, 2, 3, 3, 2, 1, 1, 2, 1, 0, 1, 1, 2, 1, 1, 1, 1},
{ 2, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{ 2, 3, 3, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1},
{ 2, 3, 3, 2, 2, 2, 1, 0, 1, 1, 2, 1, 1, 2, 1, 1, 1},
{ 2, 3, 3, 1, 2, 2, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1},
{ 2, 3, 3, 1, 2, 2, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1},
{ 2, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{ 2, 3, 3, 3, 2, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1},
{-1, 2, 3, 3, 3, 2, 2, 2, 2, 1, 0, 1, 2, 1, 1, 1,-1},
{-1,-1, 2, 3, 3, 3, 2, 1, 2, 1, 1, 2, 1, 1, 1,-1,-1},
{-1,-1,-1, 2, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
{-1,-1,-1,-1, 2, 2, 2, 2, 2, 2, 2, 2, 2,-1,-1,-1,-1},
};
void pinta(Graphics g) {
for (int i=0; i<16; i++) {
for (int j=0; j<17; j++) {
if (colMat[i][j] == -1) g.setColor(TRANSPARENT);
if (colMat[i][j] == 0) g.setColor(LIGHT_GREY);
if (colMat[i][j] == 1) g.setColor(GREY);
if (colMat[i][j] == 2) g.setColor(DARK_GREY);
if (colMat[i][j] == 3) g.setColor(VERY_DARK_GREY);
g.drawRect(x+(SIZE_PIXEL)*j, y+(SIZE_PIXEL)*i, SIZE_PIXEL, SIZE_PIXEL);
g.fillRect(x+(SIZE_PIXEL)*j, y+(SIZE_PIXEL)*i, SIZE_PIXEL, SIZE_PIXEL);
}
}
}
}