Portale
parent
5a094b1fbf
commit
abc520f2bc
|
@ -21,11 +21,11 @@
|
||||||
### ## ## ## ## ## ###
|
### ## ## ## ## ## ###
|
||||||
,,# ## ## ## ## ## ## ## #,,
|
,,# ## ## ## ## ## ## ## #,,
|
||||||
### ## ## ## ## ## ## ## ###
|
### ## ## ## ## ## ## ## ###
|
||||||
# ## P ## #
|
# ## ## #
|
||||||
### ## ##### ## ##### ## ###
|
### ## ##### ## ##### ## ###
|
||||||
### ## ##### ## ##### ## ###
|
### ## ##### ## ##### ## ###
|
||||||
# ## ## ## #
|
# ## ## ## #
|
||||||
# #### ## ######## ## #### #
|
# #### ## ######## ## #### #
|
||||||
#.#### ## ######## ## ####.#
|
#.#### ## ######## ## ####.#
|
||||||
# ## ## #
|
# ## P ## #
|
||||||
############################
|
############################
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
##################################
|
##################################
|
||||||
# #
|
# #
|
||||||
# # ## ## ################# ## # #
|
# # ## ## ################# ## # #
|
||||||
# # ## ## ## ## # #
|
# # ## ## R# ## # #
|
||||||
# ## ################# ## ## #
|
# ## ################# ## ## #
|
||||||
# # ## ## ## ## # #
|
# # ## ## ## ## # #
|
||||||
# # ## ##.##############.## ## # #
|
# # ## ##.##############.## ## # #
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
# ### ## #P############## ## ### #
|
# ### ## #P############## ## ### #
|
||||||
# ### ## # # ## ### #
|
# ### ## # # ## ### #
|
||||||
# ## # ############ # ## #
|
# ## # ############ # ## #
|
||||||
# ### ## # # ## ### #
|
# ### #L # # ## ### #
|
||||||
# ### ## ###.########.### ## ### #
|
# ### ## ###.########.### ## ### #
|
||||||
# #
|
# #
|
||||||
##################################
|
##################################
|
|
@ -0,0 +1,30 @@
|
||||||
|
############################
|
||||||
|
# ## #
|
||||||
|
#.#### ##### ## ##### ####.#
|
||||||
|
# #### ##### ## ##### #### #
|
||||||
|
# #
|
||||||
|
# #### ## ######## ## #### #
|
||||||
|
# #### ## ######## ## #### #
|
||||||
|
# ## ## ## #
|
||||||
|
###### ##### ## ##### ######
|
||||||
|
,,,,,# ##### ## ##### #,,,,,
|
||||||
|
,,,,,# ## ## #,,,,,
|
||||||
|
,,,,,# ## ## ## ## ## #,,,,,
|
||||||
|
###### ## ## ## ## ## ######
|
||||||
|
#L ,,0123,, R#
|
||||||
|
###### ## ## ## ## ## ######
|
||||||
|
,,,,,# ## ## ## ## ## #,,,,,
|
||||||
|
,,,,,# ## ## #,,,,,
|
||||||
|
,,,,,# ## ######## ## #,,,,,
|
||||||
|
###### ## ######## ## ######
|
||||||
|
# ## #
|
||||||
|
# #### ##### ## ##### #### #
|
||||||
|
# #### ##### ## ##### #### #
|
||||||
|
#. ## P ## .#
|
||||||
|
### ## ## ######## ## ## ###
|
||||||
|
### ## ## ######## ## ## ###
|
||||||
|
# ## ## ## #
|
||||||
|
# ########## ## ########## #
|
||||||
|
# ########## ## ########## #
|
||||||
|
# #
|
||||||
|
############################
|
|
@ -1,12 +1,3 @@
|
||||||
/BigPoint.class
|
|
||||||
/Brick.class
|
|
||||||
/Game.class
|
|
||||||
/Ghost.class
|
|
||||||
/Lives.class
|
|
||||||
/Main.class
|
|
||||||
/Map.class
|
|
||||||
/MapMenu$1.class
|
/MapMenu$1.class
|
||||||
/MapMenu.class
|
/MapMenu.class
|
||||||
/Picture.class
|
/Portal.class
|
||||||
/Player.class
|
|
||||||
/Point.class
|
|
||||||
|
|
BIN
bin/Game.class
BIN
bin/Game.class
Binary file not shown.
BIN
bin/Map.class
BIN
bin/Map.class
Binary file not shown.
|
@ -47,7 +47,7 @@ public class Game {
|
||||||
int[] HCost = new int[4];
|
int[] HCost = new int[4];
|
||||||
|
|
||||||
public Game(String selectedMap) { // Erstellen des Konstruktors (Was soll passieren, sobald dieses Klasse
|
public Game(String selectedMap) { // Erstellen des Konstruktors (Was soll passieren, sobald dieses Klasse
|
||||||
// aufgerufen wird?)
|
// aufgerufen wird?)
|
||||||
|
|
||||||
frame = new JFrame(); // Fenster
|
frame = new JFrame(); // Fenster
|
||||||
ImageIcon img = new ImageIcon("assets/Pacman_Right.png");
|
ImageIcon img = new ImageIcon("assets/Pacman_Right.png");
|
||||||
|
@ -133,10 +133,16 @@ public class Game {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
System.out.println(Map.Left + " " + Map.Right);
|
||||||
|
if (Map.Left != null && Map.Right != null) {
|
||||||
|
panel.add(Map.Left);
|
||||||
|
panel.add(Map.Right);
|
||||||
|
Map.Left.setBounds(Map.Left.xPos, Map.Left.yPos, 20, 20);
|
||||||
|
Map.Right.setBounds(Map.Right.xPos, Map.Right.yPos, 20, 20);
|
||||||
|
}
|
||||||
|
|
||||||
delay(30);
|
|
||||||
lastT = System.nanoTime(); // delta time
|
lastT = System.nanoTime(); // delta time
|
||||||
|
delay(1000);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -335,6 +341,28 @@ public class Game {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Map.Left != null) {
|
||||||
|
if (player.getPos('x', 0) < Map.Left.xPos + 20 && player.getPos('x', 0) > Map.Left.xPos - 20
|
||||||
|
&& player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20) {
|
||||||
|
|
||||||
|
if (Map.Right != null) {
|
||||||
|
player.xPos = Map.Right.xPos - 20;
|
||||||
|
player.yPos = Map.Right.yPos;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Map.Right != null) {
|
||||||
|
if (player.getPos('x', 0) < Map.Right.xPos + 20 && player.getPos('x', 0) > Map.Right.xPos - 20
|
||||||
|
&& player.getPos('y', 0) < Map.Right.yPos + 20 && player.getPos('y', 0) > Map.Right.yPos - 20) {
|
||||||
|
|
||||||
|
if (Map.Left != null) {
|
||||||
|
player.xPos = Map.Left.xPos + 20;
|
||||||
|
player.yPos = Map.Left.yPos;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i < 35; i++) {
|
for (int i = 0; i < 35; i++) {
|
||||||
for (int j = 0; j < 35; j++) {
|
for (int j = 0; j < 35; j++) {
|
||||||
if (Map.bigpoints[j][i] != null) {
|
if (Map.bigpoints[j][i] != null) {
|
||||||
|
|
|
@ -9,6 +9,9 @@ public class Map {
|
||||||
public static Brick bricks[][] = new Brick[35][35]; // Zweidimensionales Array für alle Bricks
|
public static Brick bricks[][] = new Brick[35][35]; // Zweidimensionales Array für alle Bricks
|
||||||
public static Point points[][] = new Point[35][35];
|
public static Point points[][] = new Point[35][35];
|
||||||
public static BigPoint bigpoints[][] = new BigPoint[35][35];
|
public static BigPoint bigpoints[][] = new BigPoint[35][35];
|
||||||
|
|
||||||
|
public static Portal Left;
|
||||||
|
public static Portal Right;
|
||||||
// Zweidimensionale Arrays siehe
|
// Zweidimensionale Arrays siehe
|
||||||
// https://de.wikipedia.org/wiki/Feld_(Datentyp)#Mehrdimensional_/_in-sich-mehrdimensional
|
// https://de.wikipedia.org/wiki/Feld_(Datentyp)#Mehrdimensional_/_in-sich-mehrdimensional
|
||||||
|
|
||||||
|
@ -83,6 +86,10 @@ public class Map {
|
||||||
} else if (line.charAt(j) == '.') {
|
} else if (line.charAt(j) == '.') {
|
||||||
bigpoints[i][j] = new BigPoint(10 + 20 * j, 10 + 20 * i);
|
bigpoints[i][j] = new BigPoint(10 + 20 * j, 10 + 20 * i);
|
||||||
|
|
||||||
|
} else if (line.charAt(j) == 'L') {
|
||||||
|
Left = new Portal(10 + 20 * j, 10 + 20 * i);
|
||||||
|
} else if (line.charAt(j) == 'R') {
|
||||||
|
Right = new Portal(10 + 20 * j, 10 + 20 * i);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,18 @@ import javax.swing.JTextField;
|
||||||
|
|
||||||
public class MapMenu extends JFrame {
|
public class MapMenu extends JFrame {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 2863784680171430142L;
|
||||||
|
|
||||||
public boolean rdy;
|
public boolean rdy;
|
||||||
|
|
||||||
JButton button;
|
JButton button;
|
||||||
|
|
||||||
JPanel panel;
|
JPanel panel;
|
||||||
|
|
||||||
JComboBox bob;
|
JComboBox<?> bob;
|
||||||
|
|
||||||
String[] maps;
|
String[] maps;
|
||||||
|
|
||||||
|
@ -45,7 +50,7 @@ public class MapMenu extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.setBounds(100, 100, 300, 200);
|
this.setBounds(750, 300, 300, 200);
|
||||||
this.setResizable(false); // Man kann die Größe des Frame nicht verändern
|
this.setResizable(false); // Man kann die Größe des Frame nicht verändern
|
||||||
|
|
||||||
panel = new JPanel(); // Panel auf dem visuellen Elemente angezeigt werden
|
panel = new JPanel(); // Panel auf dem visuellen Elemente angezeigt werden
|
||||||
|
@ -54,9 +59,9 @@ public class MapMenu extends JFrame {
|
||||||
this.setContentPane(panel);
|
this.setContentPane(panel);
|
||||||
this.getContentPane().setLayout(null);
|
this.getContentPane().setLayout(null);
|
||||||
|
|
||||||
button = new JButton("Lauch dat shit");
|
button = new JButton("Launch");
|
||||||
panel.add(button);
|
panel.add(button);
|
||||||
button.setBounds(20, 100, 150, 30);
|
button.setBounds(70, 50, 120, 30);
|
||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent evt) {
|
public void actionPerformed(ActionEvent evt) {
|
||||||
try {
|
try {
|
||||||
|
@ -67,9 +72,10 @@ public class MapMenu extends JFrame {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bob = new JComboBox(maps);
|
bob = new JComboBox<Object>(maps);
|
||||||
|
bob.setSelectedIndex(4);
|
||||||
panel.add(bob);
|
panel.add(bob);
|
||||||
bob.setBounds(30, 30, 180, 30);
|
bob.setBounds(70, 10, 120, 30);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar.
|
||||||
|
|
||||||
|
public class Portal extends Picture {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8813034369041822237L;
|
||||||
|
public int xPos;
|
||||||
|
public int yPos;
|
||||||
|
|
||||||
|
public Portal(int newXPos, int newYPos) {
|
||||||
|
|
||||||
|
super("portal");
|
||||||
|
|
||||||
|
xPos = newXPos;
|
||||||
|
yPos = newYPos;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue