package com.company; import java.util.Scanner; import javax.swing.JOptionPane; class Postac { String imie; int moc; int x; int y; public Postac(String Imie, int Moc, int X, int Y) { this.imie = Imie; this.moc = Moc; this.x = X; this.y = Y; }; public void setPozycja(int x, int y) { this.x = x; this.y = y; } int getX() { return x; } int getY() { return y; } } class Hero extends Postac { public Hero(String Imie, int Moc, int X, int Y) { super(Imie, Moc, X, Y); } public void ruch(String Ruch) { if (Ruch == "G") { this.x = x - 1; } if (Ruch == "D") { this.x = x + 1; } if (Ruch == "P") { this.y = y + 1; } if (Ruch == "L") { this.y = y - 1; } } } class Enemy extends Postac { public Enemy(String Imie, int Moc, int X, int Y) { super(Imie, Moc, X, Y); } } class Mapa { final int szerokoscPlanszy = 20; final int wysokoscPlanszy = 20; char[][] map = new char[szerokoscPlanszy][wysokoscPlanszy]; boolean jestok = true; public void sprawdz(int x, int y) { if (x < 0 || x > this.szerokoscPlanszy || y < 0 || y > this.wysokoscPlanszy) { System.out.print("\n GAME OVER "); this.jestok = false; } } void pokaz(int xx, int yy) { for (int a = 0; a < this.szerokoscPlanszy; a++) { System.out.print(a); for (int b = 0; b < this.wysokoscPlanszy; b++) { if (a == 0) System.out.print(b + " "); else if (a == xx && b == yy) { System.out.print("G" + " "); } else { System.out.print( // map[a][b] + " "); } } System.out.print("\n"); } } } public class Main { public static void main(String[] args) { Hero bohater = new Hero("Michal", 20, 10, 10); Mapa map = new Mapa(); Scanner input = new Scanner(System.in); map.pokaz(bohater.getX(), bohater.getY()); // if (map.jestok = false) { // System.out.print("KONIEC GRY"); // } else { // System.out.print("Wprowadz litere ruchu(G,D,L,P) i enter: "); // // // String steruj= input.nextLine(); // //// bohater.ruch("D"); // // map.pokaz(bohater.getX(), bohater.getY()); // // } } }