Kód: Vybrať všetko
public void stena(Graphics g, int x, int y, int orentacia, int pocet) {
Image img = Toolkit.getDefaultToolkit().getImage("image/wall.gif");
for(int i=1; i<=pocet; i++) {
switch(orentacia) {
case 0:
g.drawImage(img, x+(i*15), y, null);
rect = new Rectangle( x+(i*15), y, 15, 15);
break;
case 1:
g.drawImage(img, x, y+(i*15), null);
rect = new Rectangle( x, y+(i*15), 15, 15);
break;
}
}
}Kód: Vybrať všetko
public panacik (int pX, int pY) {
this.x = pX;
this.y = pY;
stav = 0;
rect = new Rectangle(x, y, 14, 14);
}
Prosim ako to mam prepisat alebo čo mam dopisat aby mi to vracalo TRUE/FALSE sa panačik dotkne steny??