This commit is contained in:
hihoman23 2026-07-02 12:51:00 +02:00
parent 4ae81aa454
commit d864db5aad
6 changed files with 61 additions and 18 deletions

BIN
Ghost.class Normal file

Binary file not shown.

7
Ghost.ctxt Normal file
View File

@ -0,0 +1,7 @@
#BlueJ class context
comment0.target=Ghost
comment0.text=\r\n\ Klasse\ Ghost.\r\n\ \ \r\n\ @author\ \r\n
comment1.params=game
comment1.target=Ghost(Game)
comment1.text=---------------Konstruktor---
numComments=2

25
Ghost.java Normal file
View File

@ -0,0 +1,25 @@
import java.awt.Frame;
/**
* Klasse Ghost.
*
* @author
*/
public class Ghost {
/*---------------Attribute-----*/
int x;
int y;
Game game;
int gameFrame;
/*---------------Konstruktor---*/
public Ghost(Game game) {
x = 20; y = 20;
this.game = game;
}
/*---------------Methoden------*/
}

Binary file not shown.

View File

@ -26,18 +26,19 @@ public class Pacman {
if (keyCode == game.LEFT) {
x -= game.cellSize;
}
x = (x + (11 * game.cellSize)) % (11 * game.cellSize);
if (keyCode == game.UP) {
y -= game.cellSize;
}
if (keyCode == game.DOWN) {
y += game.cellSize;
}
y = (y + (11 * game.cellSize)) % (11 * game.cellSize);
if (!game.wantMove(oldX/game.cellSize, oldY/game.cellSize, x/game.cellSize, y/game.cellSize)) {
x = oldX;
y = oldY;
}
x = (x + (11 * game.cellSize)) % (11 * game.cellSize);
y = (y + (11 * game.cellSize)) % (11 * game.cellSize);
}
public void draw() {

View File

@ -8,25 +8,28 @@ dependency2.type=UsesDependency
dependency3.from=Game
dependency3.to=Pacman
dependency3.type=UsesDependency
dependency4.from=Render
dependency4.from=Ghost
dependency4.to=Game
dependency4.type=UsesDependency
editor.fx.0.height=0
editor.fx.0.width=0
editor.fx.0.x=0
editor.fx.0.y=0
dependency5.from=Render
dependency5.to=Game
dependency5.type=UsesDependency
editor.fx.0.height=739
editor.fx.0.width=816
editor.fx.0.x=552
editor.fx.0.y=98
objectbench.height=93
objectbench.width=760
package.divider.horizontal=0.6
package.divider.vertical=0.8
package.editor.height=393
package.editor.width=649
package.editor.x=20
package.editor.y=248
package.editor.x=374
package.editor.y=268
package.frame.height=600
package.frame.width=800
package.numDependencies=4
package.numTargets=3
package.numDependencies=5
package.numTargets=4
package.showExtends=true
package.showUses=true
project.charset=UTF-8
@ -40,19 +43,26 @@ target1.name=Pacman
target1.showInterface=false
target1.type=ClassTarget
target1.width=120
target1.x=70
target1.y=10
target1.x=370
target1.y=20
target2.height=70
target2.name=Game
target2.showInterface=false
target2.type=ClassTarget
target2.width=120
target2.x=290
target2.y=40
target2.x=10
target2.y=90
target3.height=70
target3.name=Render
target3.name=Ghost
target3.showInterface=false
target3.type=ClassTarget
target3.width=120
target3.x=80
target3.y=200
target3.x=430
target3.y=210
target4.height=70
target4.name=Render
target4.showInterface=false
target4.type=ClassTarget
target4.width=120
target4.x=80
target4.y=200