diff --git a/Ghost.class b/Ghost.class new file mode 100644 index 0000000..619e243 Binary files /dev/null and b/Ghost.class differ diff --git a/Ghost.ctxt b/Ghost.ctxt new file mode 100644 index 0000000..d0101f6 --- /dev/null +++ b/Ghost.ctxt @@ -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 diff --git a/Ghost.java b/Ghost.java new file mode 100644 index 0000000..5bac720 --- /dev/null +++ b/Ghost.java @@ -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------*/ + + + +} diff --git a/Pacman.class b/Pacman.class index fa7dcec..39ae356 100644 Binary files a/Pacman.class and b/Pacman.class differ diff --git a/Pacman.java b/Pacman.java index 791997f..907f13c 100644 --- a/Pacman.java +++ b/Pacman.java @@ -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() { diff --git a/package.bluej b/package.bluej index 9f48ba7..232ae34 100644 --- a/package.bluej +++ b/package.bluej @@ -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