master
leventius imperatus 2020-06-08 15:37:07 +02:00
parent 14c6275f24
commit eb3bce08f5
13 changed files with 38 additions and 29 deletions

13
bin/.gitignore vendored
View File

@ -1 +1,14 @@
/BigPoint.class
/Brick.class
/Game.class
/Ghost.class
/Hintergrund.class
/Lives.class
/Main.class
/Map.class
/MapMenu$1.class
/MapMenu.class
/Picture.class
/Player.class
/Point.class
/Portal.class

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -292,6 +292,7 @@ public class Game {
// Kollision von Pac-Man mit Bricks:
for (int i = 0; i < 35; i++) { // für jeden Brick
for (int j = 0; j < 35; j++) { // für jeden Brick
if (Map.bricks[j][i] != null) { // Damit kein Fehler auftritt wegen nicht vorhandenen Bricks
if (player.getPos('x', 0) < Map.bricks[j][i].xPos + 20
&& player.getPos('x', 0) > Map.bricks[j][i].xPos - 20
@ -317,10 +318,6 @@ public class Game {
}
}
}
}
for (int i = 0; i < 35; i++) {
for (int j = 0; j < 35; j++) {
if (Map.points[j][i] != null) {
if (player.getPos('x', 0) < Map.points[j][i].xPos + 5
&& player.getPos('x', 0) > Map.points[j][i].xPos - 5
@ -336,32 +333,7 @@ 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 j = 0; j < 35; j++) {
if (Map.bigpoints[j][i] != null) {
if (player.getPos('x', 0) < Map.bigpoints[j][i].xPos + 6
&& player.getPos('x', 0) > Map.bigpoints[j][i].xPos - 6
@ -395,6 +367,30 @@ 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;
}
}
}