From 31335495da81dc1b788096298d78ecfda3f298e4 Mon Sep 17 00:00:00 2001 From: StamateValentin Date: Sat, 10 Aug 2019 00:19:19 +0300 Subject: [PATCH] new ghost --- LICENCE.md => LICENSE.md | 0 README.md | 17 +++-- Sketch/Blinky.pde | 39 +++++++++++ Sketch/Cell.pde | 4 +- Sketch/Clyde.pde | 44 ++++++++++++ Sketch/Destroyer.pde | 36 ---------- Sketch/Ghost.pde | 99 ++++++++++++++++++-------- Sketch/Inky.pde | 46 ++++++++++++ Sketch/PacMan.pde | 45 +++++------- Sketch/Pinky.pde | 36 +++++++--- Sketch/Sketch.pde | 148 +++++++++++++++++++++------------------ Sketch/Tricky.pde | 36 ---------- 12 files changed, 336 insertions(+), 214 deletions(-) rename LICENCE.md => LICENSE.md (100%) create mode 100644 Sketch/Blinky.pde create mode 100644 Sketch/Clyde.pde delete mode 100644 Sketch/Destroyer.pde create mode 100644 Sketch/Inky.pde delete mode 100644 Sketch/Tricky.pde diff --git a/LICENCE.md b/LICENSE.md similarity index 100% rename from LICENCE.md rename to LICENSE.md diff --git a/README.md b/README.md index c3268ed..3461e2d 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,26 @@ #

PacMan

- +

### About The game was made using [Processing](https://processing.org). +For ghosts I used A* algorithm. -The rules are pretty straight forward : eat the food , don't be the food. +The rules are pretty straight forward : eat the food , don't be the food. + +I think I finished this game. I kinda make this game harder to play than I thought... but it works. I tried to make it look very similar with the original game : the map, the ghosts behavior and I added the path each one is following. +For more information about the original game check the credits below. ### What's New? -* A nice looking path -* Ghost interaction with Pacman -* Weak Mode for ghosts -* Auto return to home when a ghost is eaten by Pacman -* Few bugs fixed +* New ghost +* Ghosts behavior improved ### Credits * [CodeBullet](https://www.youtube.com/channel/UC0e3QhIYukixgh5VVpKHH9Q) * [GeeksForGeeks](https://www.geeksforgeeks.org) * [Wikipedia](https://en.wikipedia.org/wiki/Pac-Man) + * [DEV](https://dev.to/code2bits/pac-man-patterns--ghost-movement-strategy-pattern-1k1a) + * [TodayIFoundOut](http://www.todayifoundout.com/index.php/2015/10/ghosts-pac-man-work/) diff --git a/Sketch/Blinky.pde b/Sketch/Blinky.pde new file mode 100644 index 0000000..0b632fd --- /dev/null +++ b/Sketch/Blinky.pde @@ -0,0 +1,39 @@ +// blinky alway chase pacman +// TODO Cruise Elroy (speed increasing) +class Blinky extends Ghost { + Blinky(int i, int j){ + super(i, j); + super.currentCell = array.get(i).get(j); + } + + public void search() { + + if(super.x % sc == 0 && super.y % sc == 0){ + super.i = (int)super.y / sc; + super.j = (int)super.x / sc; + + super.currentCell = array.get(super.i).get(super.j); + + // when is weak and can be eaten by pacman it choses a random cell + if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ + + if(super.searchingList.size() <= 2 ){ + if(super.isWeak){ + super.cellToFollow = super.getRandomCell(); + } else if(super.isRecovering){ + super.cellToFollow = super.getRandomCellFromHouse(); + } + } + } + else { + // here is the specific behaviour + super.cellToFollow = pacman.currentCell; + } + + AStar( super.currentCell, super.cellToFollow ); + super.searchingList = path; + + } + super.update(); + } +} diff --git a/Sketch/Cell.pde b/Sketch/Cell.pde index a5cdac4..baf250c 100644 --- a/Sketch/Cell.pde +++ b/Sketch/Cell.pde @@ -1,9 +1,11 @@ class Cell{ public int i, j; - public boolean isWall = false; public float f = Float.MAX_VALUE, h, g; public Cell parent; + + public boolean isWall = false; public boolean tempViz = false; + Cell(int i, int j){ this.i = i; this.j = j; diff --git a/Sketch/Clyde.pde b/Sketch/Clyde.pde new file mode 100644 index 0000000..e31b7b7 --- /dev/null +++ b/Sketch/Clyde.pde @@ -0,0 +1,44 @@ +// Clyde search for the tile 8 away from pacman +class Clyde extends Ghost { + private int newSearch = 10; + Clyde(int i, int j){ + super(i, j); + super.currentCell = array.get(i).get(j); + } + + public void search() { + + if(super.x % sc == 0 && super.y % sc == 0){ + super.i = (int)super.y / sc; + super.j = (int)super.x / sc; + + this.newSearch--; + + super.currentCell = array.get(super.i).get(super.j); + + // when is weak and can be eaten by pacman it choses a random cell + if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ + this.newSearch = 1; + if(super.searchingList.size() <= 2 ){ + if(super.isWeak){ + super.cellToFollow = super.getRandomCell(); + } else if(super.isRecovering){ + super.cellToFollow = super.getRandomCellFromHouse(); + } + } + } + else { + // here is the specific behaviour + if(this.newSearch == 0){ + super.cellToFollow = super.getCellInFrontOf(12); + this.newSearch = 10; + } + } + + AStar( super.currentCell, super.cellToFollow ); + super.searchingList = path; + + } + super.update(); + } +} diff --git a/Sketch/Destroyer.pde b/Sketch/Destroyer.pde deleted file mode 100644 index 7b0e64b..0000000 --- a/Sketch/Destroyer.pde +++ /dev/null @@ -1,36 +0,0 @@ -class Destroyer extends Ghost { - Destroyer(int x, int y){ - super(x, y); - super.currentCell = array.get(y / sc).get(x / sc); - } - - public void search() { - // best search - if(super.x % sc == 0 && super.y % sc == 0){ - super.i = (int)super.y / sc; - super.j = (int)super.x / sc; - - super.currentCell = array.get(super.i).get(super.j); - // when is weak and can be af - if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ - // pincky style - super.searchingList.remove( super.currentCell ); - - AStar(super.currentCell, super.cellToFollow); - super.searchingList = path; - - if(super.searchingList.size() <= 2 ){ - if(super.isWeak) - super.cellToFollow = super.getRandomCell(); - else if(super.isRecovering) - super.cellToFollow = super.getRandomCellFromHome(); - } - - } else { - AStar( super.currentCell, pacman.currentCell ); - super.searchingList = path; - } - } - super.update(); - } -} diff --git a/Sketch/Ghost.pde b/Sketch/Ghost.pde index 41f33cd..a3afaa2 100644 --- a/Sketch/Ghost.pde +++ b/Sketch/Ghost.pde @@ -3,42 +3,35 @@ import java.util.List; class Ghost { public float x, y; - private List searchingList; - private int dirX = 1, dirY = 0; + public int i, j; private float speed = 2.5; - private int i, j; + private int dirX = 1, dirY = 0; private int r, g, b; - private Cell cellToFollow; - private List homeCells; - private Cell currentCell; + private Cell currentCell, cellToFollow; + private List searchingList, ghostHouseCells; public boolean isWeak = false; public boolean isRecovering = false; - public boolean isAffectedBy = false; - - // the weak time is controled by pacman.isInvincible private int recoveringCountDowm = 720;// 12 sec - Ghost(int x, int y){ - this.x = x; - this.y = y; + + Ghost(int i, int j){ + this.x = j * sc; + this.y = i * sc; this.searchingList = new ArrayList(); this.cellToFollow = this.getRandomCell(); - this.homeCells = new ArrayList(); + this.ghostHouseCells = new ArrayList(); - for(int i = 13; i <= 15; i++){ - for(int j = 11; j <= 16; j ++){ - this.homeCells.add( array.get(i).get(j) ); + for(int k = 13; k <= 15; k++){ + for(int l = 11; l <= 16; l ++){ + this.ghostHouseCells.add( array.get(k).get(l) ); } } } private void update(){ if(this.x % sc == 0 && this.y % sc == 0){ - //search is called first so it's irrelevant - // i = (int)this.y / sc; - // j = (int)this.x / sc; Cell up = null, left = null, down = null, right = null; try{ @@ -79,9 +72,8 @@ class Ghost { } - // for a bug, if not i think there is a 50% chance if(this.x % 2.5 == 0 && this.y % 2.5 == 0){ - if( (this.isWeak || this.isRecovering) && this.isAffectedBy){// TODO + if( (this.isWeak || this.isRecovering) && this.isAffectedBy){ this.speed = 1.25; } else{ this.speed = 2.5; @@ -90,7 +82,7 @@ class Ghost { if(this.isRecovering){ if(this.recoveringCountDowm == 0){ - println("stops recovering"); + //println("Stop Recovering"); this.recoveringCountDowm = 720; this.isRecovering = false; this.isAffectedBy = false; @@ -122,7 +114,7 @@ class Ghost { public void makeWeak(){ if(!this.isWeak && this.isAffectedBy){ - println("ghost weak"); + //println("Ghost Weak"); this.cellToFollow = this.getRandomCell(); this.isWeak = true; } @@ -130,7 +122,7 @@ class Ghost { public void makeNormal(){ if(this.isWeak){ - println("ghost normal"); + //println("Ghost Normal"); this.isWeak = false; this.isAffectedBy = false; } @@ -138,10 +130,10 @@ class Ghost { public void retreat(){ if(!this.isRecovering && this.isAffectedBy){ - println("ghost retreat"); + //println("Ghost Retreat"); this.isRecovering = true; this.isWeak = false; - this.cellToFollow = this.getRandomCellFromHome(); + this.cellToFollow = this.getRandomCellFromHouse(); } } @@ -166,6 +158,7 @@ class Ghost { } line(current.x , current.y , next.x , next.y ); } + } private Cell getRandomCell(){ @@ -180,9 +173,57 @@ class Ghost { return c; } - private Cell getRandomCellFromHome(){ - int n = (int)random(0, this.homeCells.size()); - return this.homeCells.get(n); + private Cell getRandomCellFromHouse(){ + int n = (int)random(0, this.ghostHouseCells.size()); + return this.ghostHouseCells.get(n); + } + + private Cell getCellInFrontOf(int n){ + List positions = new ArrayList(); + int i = pacman.i + pacman.dirY; + int j = pacman.j + pacman.dirX; + + Cell initial = array.get(pacman.i).get(pacman.j); + Cell root = array.get(i).get(j); + Cell c = null; + + for(int l = 1; l <= n; l ++){ + positions.clear(); + try{ + c = array.get(root.i - 1).get(root.j); + if(!c.isWall) + positions.add( c ); + } catch (Exception e){} + try{ + c = array.get(root.i).get(root.j - 1); + if(!c.isWall) + positions.add( c ); + } catch (Exception e){} + try{ + c = array.get(root.i + 1).get(root.j); + if(!c.isWall) + positions.add( c ); + } catch (Exception e){} + try{ + c = array.get(root.i).get(root.j + 1); + if(!c.isWall) + positions.add( c ); + } catch (Exception e){} + + positions.remove(initial); + initial = root; + + int x = (int)random(0, positions.size()); + try{ + root = positions.get(x); + } catch(Exception e){ + root = this.getRandomCell(); + break; + } + } + // fill(255, 0, 0); + // rect(root.j * sc, root.i * sc, sc, sc); + return root; } } diff --git a/Sketch/Inky.pde b/Sketch/Inky.pde new file mode 100644 index 0000000..0dd118e --- /dev/null +++ b/Sketch/Inky.pde @@ -0,0 +1,46 @@ +// Inky is dummy +class Inky extends Ghost{ + Inky(int x, int y){ + super(x, y); + } + + public void search() { + + if(super.x % sc == 0 && super.y % sc == 0){ + super.i = (int)super.y / sc; + super.j = (int)super.x / sc; + + super.currentCell = array.get(super.i).get(super.j); + + // when is weak and can be eaten by pacman it choses a random cell + if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ + + if(super.searchingList.size() <= 2 ){ + if(super.isWeak){ + super.cellToFollow = super.getRandomCell(); + } else if(super.isRecovering){ + super.cellToFollow = super.getRandomCellFromHouse(); + } + } + } + else { + // here is the specific behaviour + int possibleI = 2 * pacman.i - blinky.i; + int possibleJ = 2 * pacman.j - blinky.j; + // for the explanation of what he follows search it on Google + try{ + if( !array.get(possibleI).get(possibleJ).isWall ) + super.cellToFollow = array.get(possibleI).get(possibleJ); + } catch(Exception e){ + if(super.searchingList.size() <= 2) + super.cellToFollow = super.getRandomCell(); + } + } + + AStar( super.currentCell, super.cellToFollow ); + super.searchingList = path; + + } + super.update(); + } +} diff --git a/Sketch/PacMan.pde b/Sketch/PacMan.pde index ef71814..fb845ce 100644 --- a/Sketch/PacMan.pde +++ b/Sketch/PacMan.pde @@ -1,31 +1,28 @@ class PacMan{ public float x = 12 * sc, y = 23 * sc; private int dirLineX = 12, dirLineY = 23; - private int dirX = -1, dirY = 0; + public int dirX = -1, dirY = 0; private int newDirX, newDirY; private float speed = 2.5; // math stuff , 2.5 * 8 = sc - + public int i, j; - public Cell oldPosition = array.get(23).get(12); public boolean isInvincible = false; private int countDown = 600; public Cell currentCell = array.get(23).get(12); public void update(){ - if(frameCount % 100 == 0){ - // update the old position every 1.40 second for Tricky - this.oldPosition = this.currentCell; - } - if( this.x % 20 == 0 && this.y % 20 == 0 ){ - this.j = (int)this.x / sc; this.i = (int)this.y / sc; + this.j = (int)this.x / sc; - // for food - if(a[this.i][this.j] != '-') - a[this.i][this.j] = '0'; + food.remove( array.get(this.i).get(this.j) ); + + if( this.checkBonus() ){ + this.isInvincible = true; + this.countDown = 600; + } if( a[ this.i ][ this.j ] == '-' && this.j == 0){ this.x = 27 * sc; @@ -51,28 +48,19 @@ class PacMan{ if( a[ newPositionY ][ newPositionX ] != '1' ){ this.dirX = this.newDirX; this.dirY = this.newDirY; - - this.j = newPositionX; - this.i = newPositionY; } } catch(Exception e){} this.currentCell = array.get(this.i).get(this.j); - if( this.checkBonus() ){ - println("pacman isInvincible"); - this.isInvincible = true; - this.countDown = 600; - } - } if(this.isInvincible){ if(this.countDown != 0 ){ this.countDown --; } else { - println("pacman not invincible"); + //println("PacMan Is Normal"); this.isInvincible = false; } } @@ -85,7 +73,7 @@ class PacMan{ private void show(){ noStroke(); - fill(255, 247, 130); + fill(255, 255, 0); circle(this.x, this.y, 25); } @@ -95,12 +83,13 @@ class PacMan{ } private boolean checkBonus(){ - if(a[this.i][this.j] == '3'){ - // i don't know what i am doing - destroyer.isAffectedBy = true; - tricky.isAffectedBy = true; + if( bonusFood.contains( array.get(this.i).get(this.j) ) ){ + blinky.isAffectedBy = true; pinky.isAffectedBy = true; - + inky.isAffectedBy = true; + clyde.isAffectedBy = true; + bonusFood.remove( array.get(this.i).get(this.j) ); + //println("PacMan Is Invincible"); return true; } return false; diff --git a/Sketch/Pinky.pde b/Sketch/Pinky.pde index 76260cc..a0a769a 100644 --- a/Sketch/Pinky.pde +++ b/Sketch/Pinky.pde @@ -1,26 +1,44 @@ +// Pinky is the one who try to ambush pacman +// TODO work on pinky class Pinky extends Ghost{ - Pinky(int x, int y){ - super(x, y); + private int newSearch = 8; + Pinky(int i, int j){ + super(i, j); } public void search() { - // worst search if(super.x % sc == 0 && super.y % sc == 0){ super.i = (int)super.y / sc; super.j = (int)super.x / sc; + this.newSearch --; + super.currentCell = array.get(super.i).get(super.j); + // when is weak and can be eaten by pacman it choses a random cell + if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ + this.newSearch = 1; + + if(super.searchingList.size() <= 2 ){ + if(super.isWeak){ + super.cellToFollow = super.getRandomCell(); + } else if(super.isRecovering){ + super.cellToFollow = super.getRandomCellFromHouse(); + } + } + } + else { + // here is the specific behaviour + if(this.newSearch == 0){ + super.cellToFollow = super.getCellInFrontOf(6); + this.newSearch = 8; + } + } + AStar(super.currentCell, super.cellToFollow); super.searchingList = path; - if(super.searchingList.size() <= 2 ){ - if(super.isRecovering) - super.cellToFollow = super.getRandomCellFromHome(); - else - super.cellToFollow = super.getRandomCell(); - } } super.update(); } diff --git a/Sketch/Sketch.pde b/Sketch/Sketch.pde index a84c16f..2941f6a 100644 --- a/Sketch/Sketch.pde +++ b/Sketch/Sketch.pde @@ -4,18 +4,20 @@ import java.util.ArrayList; PImage img, c; int sc = 20, rows, cols; -Destroyer destroyer; -Tricky tricky; +Blinky blinky; Pinky pinky; +Inky inky; +Clyde clyde; PacMan pacman; + List< List > array; -List path = new ArrayList(); +List path, food, bonusFood; void setup() { - size( 560 , 620 ); - background( 15 ); - frameRate( 60 ); + size(560, 620); + background(15); + frameRate(60); img = loadImage("PacmanBoard.png"); image(img, 0, 0); @@ -25,25 +27,34 @@ void setup() { cols = width / sc; array = new ArrayList< List >(); + path = new ArrayList(); + food = new ArrayList(); + bonusFood = new ArrayList(); + for(int i = 0; i < rows; i ++){ array.add( new ArrayList() ); for(int j = 0; j < cols; j ++){ array.get(i).add( new Cell(i, j) ); if( a[i][j] == '1' ) array.get(i).get(j).isWall = true; + else if(a[i][j] == '2') + food.add( array.get(i).get(j) ); + else if(a[i][j] == '3') + bonusFood.add( array.get(i).get(j) ); } } pacman = new PacMan(); - destroyer = new Destroyer(20, 20); - destroyer.SetColor(239, 106, 106); - - tricky = new Tricky(13 * sc, 11 * sc); - tricky.SetColor(87, 242, 176); + blinky = new Blinky(13, 13); + pinky = new Pinky(14, 13); + inky = new Inky(14, 12); + clyde = new Clyde(14, 14); - pinky = new Pinky(15 * sc, 11 * sc); - pinky.SetColor(164, 53, 229); + blinky.SetColor(255, 95, 95); + pinky.SetColor(255, 184, 255); + inky.SetColor(0, 255, 255); + clyde.SetColor(255, 184, 81); rectMode(RADIUS); } @@ -52,101 +63,102 @@ void draw() { background( 15 ); image(c, 0, 0); translate(sc / 2, sc / 2); - destroyer.drawPath(); - tricky.drawPath(); + + blinky.drawPath(); pinky.drawPath(); + inky.drawPath(); + clyde.drawPath(); + drawCoins(); pacman.update(); if(pacman.isInvincible){ - if(!destroyer.isWeak && !destroyer.isRecovering && destroyer.isAffectedBy){ - destroyer.makeWeak(); - } - if(!tricky.isWeak && !tricky.isRecovering && tricky.isAffectedBy){ - tricky.makeWeak(); + if(!blinky.isWeak && !blinky.isRecovering && blinky.isAffectedBy){ + blinky.makeWeak(); } if(!pinky.isWeak && !pinky.isRecovering && pinky.isAffectedBy){ pinky.makeWeak(); } - } else { - if(destroyer.isWeak){ - destroyer.makeNormal(); + + if(!inky.isWeak && !inky.isRecovering && inky.isAffectedBy){ + inky.makeWeak(); + } + if(!clyde.isWeak && !clyde.isRecovering && clyde.isAffectedBy){ + clyde.makeWeak(); } - if(tricky.isWeak){ - tricky.makeNormal(); + } else { + if(blinky.isWeak){ + blinky.makeNormal(); } if(pinky.isWeak){ pinky.makeNormal(); } + if(inky.isWeak){ + inky.makeNormal(); + } + if(clyde.isWeak){ + clyde.makeNormal(); + } + } + + //check collision with pacman + if( Math.abs(pacman.x - blinky.x) < sc + 10 && Math.abs(pacman.y - blinky.y) < sc + 10 ) { + if(pacman.isInvincible && blinky.isAffectedBy){ + blinky.retreat(); + } else { + print("Caught By Blinky"); + noLoop(); + } } - // check collision with pacman - if( Math.abs(pacman.x - destroyer.x) < sc + 10 && Math.abs(pacman.y - destroyer.y) < sc + 10 ) { - if(pacman.isInvincible && destroyer.isAffectedBy){ - destroyer.retreat(); + if( Math.abs(pacman.x - pinky.x) < sc + 10 && Math.abs(pacman.y - pinky.y) < sc + 10 ) { + if(pacman.isInvincible && pinky.isAffectedBy){ + pinky.retreat(); } else { - print("Game OverDEST"); + print("Caught By Pinky"); noLoop(); } } - if( Math.abs(pacman.x - tricky.x) < sc + 10 && Math.abs(pacman.y - tricky.y) < sc + 10 ) { - if(pacman.isInvincible && tricky.isAffectedBy){ - tricky.retreat(); + + if( Math.abs(pacman.x - inky.x) < sc + 10 && Math.abs(pacman.y - inky.y) < sc + 10 ) { + if(pacman.isInvincible && inky.isAffectedBy){ + inky.retreat(); } else { - print("Game OverTRY"); + print("Caught By Inky"); noLoop(); } } - if( Math.abs(pacman.x - pinky.x) < sc + 10 && Math.abs(pacman.y - pinky.y) < sc + 10 ) { - if(pacman.isInvincible && pinky.isAffectedBy){ - pinky.retreat(); + if( Math.abs(pacman.x - clyde.x) < sc + 10 && Math.abs(pacman.y - clyde.y) < sc + 10 ) { + if(pacman.isInvincible && clyde.isAffectedBy){ + clyde.retreat(); } else { - print("Game OverPINK"); + print("Caught By Clyde"); noLoop(); } } - destroyer.search(); - tricky.search(); + blinky.search(); pinky.search(); + inky.search(); + clyde.search(); } void drawCoins(){ strokeWeight(0); stroke(15); - fill(255, 246, 107); - int score = 0; - for(int i = 1; i < 30; i++){ - for(int j = 1; j < 28; j++){ - if(a[ i ][ j ] == '2'){ - circle( j * sc, i * sc, 8); - score++; - } else - if(a[i][j] == '3'){ - circle(j * sc, i * sc, 12); - score++; - } - } - } - if(score == 0){ - println(""); - print("You win"); + fill(255, 184, 151); + + for(Cell c : food) + circle(c.j * sc, c.i * sc, 6); + for(Cell c : bonusFood) + circle(c.j * sc, c.i * sc, 16); + if(food.size() == 0 && bonusFood.size() == 0){ + println("\nYou win"); noLoop(); } } -void showMatrix(){ - for(int i = 0; i < 31; i++){ - for(int j = 0; j < 28; j++){ - boolean b = array.get(i).get(j).isWall; - if(b) - print(1); - else print(0); - }println(); - } -} - void keyPressed(){ if(keyCode == UP) diff --git a/Sketch/Tricky.pde b/Sketch/Tricky.pde deleted file mode 100644 index 6d9b869..0000000 --- a/Sketch/Tricky.pde +++ /dev/null @@ -1,36 +0,0 @@ -class Tricky extends Ghost{ - Tricky(int x, int y){ - super(x, y); - } - - public void search() { - - if(super.x % sc == 0 && super.y % sc == 0){ - - super.i = (int)super.y / sc; - super.j = (int)super.x / sc; - - super.currentCell = array.get(super.i).get(super.j); - - if( (super.isWeak || super.isRecovering ) && super.isAffectedBy ){ - // pincky style - super.searchingList.remove( super.currentCell ); - - AStar(array.get(super.i).get(super.j), super.cellToFollow); - super.searchingList = path; - - if(super.searchingList.size() <= 2){ - if(super.isWeak) - super.cellToFollow = super.getRandomCell(); - else if(super.isRecovering) - super.cellToFollow = super.getRandomCellFromHome(); - } - } else { - AStar(super.currentCell, pacman.oldPosition); - super.searchingList = path; - } - - } - super.update(); - } -}