code:
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
| import java.awt.*;
import java.applet.Applet;
public class Muur extends Applet {
int positieX, positieY, baksteen;
int schuif = 1;
public void paint(Graphics m) {
do {
m.setColor(Color.cyan);
m.fillRect(positieX, positieY, 50, 20);
positieX = positieX + 55;
baksteen ++;
if(baksteen == 5) {
positieX = 0;
positieY = positieY + 25;
baksteen = 0;
if(schuif == 1){
positieX = positieX + 25;
schuif = 0;
}
if(schuif == 0) {
positieX = 0;
schuif = 1;
}
}
} while(positieY < 160);
}
} |
de bedoeling is dat er een muurtje wordt gebouwd, zo:
code:
1
2
3
| x x x x x x x x x x x x x x x |
etcetc.
maar dit krijgen we:
code:
1
2
3
| x x x x x x x x x x x x x x x |
Iemand enig idee waarom deze het niet zou doen?