Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- super.paintComponent(g);
- int currentX = x;
- int currentY = y;
- double currentWidth = width;
- double currentHeight = height;
- =========================================================================
- Also die breite und länge soll je nach Größe des Spielfeldes halt etwas verkleinert oder vergrößert werden, z.B. wenns 3 Felder
- sind soll breite und länge 200 sein, aber bei 9 felder nur noch ein drittel wenn du verstehst was ich meine, mir fällt einfach
- nicht wirklich eine methode ein wie ich das propotional machen kann, habs jetzt erstmal so gemacht was "RELATIV" geht aber trotzdem
- halt nicht Pefekt ist.
- if(size <= 6) {
- currentWidth = (double)width - ((double)width * ((double)size/10));
- currentHeight = (double)height - ((double)height * ((double)size/10));
- System.out.println(currentWidth);
- } else if (size > 6 && size < 10) {
- currentWidth = (double)width - ((double)width * ((double)size/10));
- currentHeight = (double)height - ((double)height * ((double)size/10));
- currentWidth = currentWidth*2;
- currentHeight = currentHeight*2;
- } else if(size > 10 && size < 13) {
- currentWidth = (double)width - ((double)width * ((double)size/15));
- currentHeight = (double)height - ((double)height * ((double)size/15));
- currentWidth = currentWidth*1.2;
- currentHeight = currentHeight*1.2;
- } else {
- System.out.println("mistake");
- }
- System.out.println(currentWidth);
- ================================================================================
- ((Graphics2D) g).setStroke(new BasicStroke(10));
- g.setColor(Color.BLACK);
- for(int i = 0; i < size; i++) {
- for(int j = 0; j < size; j++) {
- g.drawRect(currentX, currentY, (int)currentWidth, (int)currentHeight);
- currentX +=currentWidth;
- }
- currentX = x;
- currentY +=currentHeight;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement