pac-man-phaser 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/index.d.ts +4 -2
  2. package/dist/index.js +1230 -3
  3. package/package.json +4 -5
  4. package/dist/assets/spritesheet.webp +0 -0
  5. package/dist/game/_scenes/game-over-scene.d.ts +0 -9
  6. package/dist/game/_scenes/game-over-scene.d.ts.map +0 -1
  7. package/dist/game/_scenes/game-over-scene.js +0 -59
  8. package/dist/game/_scenes/game-over-scene.js.map +0 -1
  9. package/dist/game/_scenes/pac-man-scene.d.ts +0 -14
  10. package/dist/game/_scenes/pac-man-scene.d.ts.map +0 -1
  11. package/dist/game/_scenes/pac-man-scene.js +0 -155
  12. package/dist/game/_scenes/pac-man-scene.js.map +0 -1
  13. package/dist/game/_scenes/pause-scene.d.ts +0 -5
  14. package/dist/game/_scenes/pause-scene.d.ts.map +0 -1
  15. package/dist/game/_scenes/pause-scene.js +0 -28
  16. package/dist/game/_scenes/pause-scene.js.map +0 -1
  17. package/dist/game/constants.d.ts +0 -19
  18. package/dist/game/constants.d.ts.map +0 -1
  19. package/dist/game/constants.js +0 -27
  20. package/dist/game/constants.js.map +0 -1
  21. package/dist/game/sprites/abstracts/action-item.d.ts +0 -5
  22. package/dist/game/sprites/abstracts/action-item.d.ts.map +0 -1
  23. package/dist/game/sprites/abstracts/action-item.js +0 -4
  24. package/dist/game/sprites/abstracts/action-item.js.map +0 -1
  25. package/dist/game/sprites/abstracts/item.d.ts +0 -6
  26. package/dist/game/sprites/abstracts/item.d.ts.map +0 -1
  27. package/dist/game/sprites/abstracts/item.js +0 -12
  28. package/dist/game/sprites/abstracts/item.js.map +0 -1
  29. package/dist/game/sprites/characters/character.d.ts +0 -20
  30. package/dist/game/sprites/characters/character.d.ts.map +0 -1
  31. package/dist/game/sprites/characters/character.js +0 -125
  32. package/dist/game/sprites/characters/character.js.map +0 -1
  33. package/dist/game/sprites/ghosts/blinky.d.ts +0 -11
  34. package/dist/game/sprites/ghosts/blinky.d.ts.map +0 -1
  35. package/dist/game/sprites/ghosts/blinky.js +0 -25
  36. package/dist/game/sprites/ghosts/blinky.js.map +0 -1
  37. package/dist/game/sprites/ghosts/clyde.d.ts +0 -10
  38. package/dist/game/sprites/ghosts/clyde.d.ts.map +0 -1
  39. package/dist/game/sprites/ghosts/clyde.js +0 -31
  40. package/dist/game/sprites/ghosts/clyde.js.map +0 -1
  41. package/dist/game/sprites/ghosts/ghost.d.ts +0 -48
  42. package/dist/game/sprites/ghosts/ghost.d.ts.map +0 -1
  43. package/dist/game/sprites/ghosts/ghost.js +0 -323
  44. package/dist/game/sprites/ghosts/ghost.js.map +0 -1
  45. package/dist/game/sprites/ghosts/inky.d.ts +0 -11
  46. package/dist/game/sprites/ghosts/inky.d.ts.map +0 -1
  47. package/dist/game/sprites/ghosts/inky.js +0 -50
  48. package/dist/game/sprites/ghosts/inky.js.map +0 -1
  49. package/dist/game/sprites/ghosts/pinky.d.ts +0 -10
  50. package/dist/game/sprites/ghosts/pinky.d.ts.map +0 -1
  51. package/dist/game/sprites/ghosts/pinky.js +0 -42
  52. package/dist/game/sprites/ghosts/pinky.js.map +0 -1
  53. package/dist/game/sprites/pac-man.d.ts +0 -17
  54. package/dist/game/sprites/pac-man.d.ts.map +0 -1
  55. package/dist/game/sprites/pac-man.js +0 -264
  56. package/dist/game/sprites/pac-man.js.map +0 -1
  57. package/dist/game/sprites/pellet.d.ts +0 -7
  58. package/dist/game/sprites/pellet.d.ts.map +0 -1
  59. package/dist/game/sprites/pellet.js +0 -15
  60. package/dist/game/sprites/pellet.js.map +0 -1
  61. package/dist/game/sprites/super-pellet.d.ts +0 -13
  62. package/dist/game/sprites/super-pellet.d.ts.map +0 -1
  63. package/dist/game/sprites/super-pellet.js +0 -67
  64. package/dist/game/sprites/super-pellet.js.map +0 -1
  65. package/dist/game/sprites/wall.d.ts +0 -5
  66. package/dist/game/sprites/wall.d.ts.map +0 -1
  67. package/dist/game/sprites/wall.js +0 -16
  68. package/dist/game/sprites/wall.js.map +0 -1
  69. package/dist/game/ui/score-display.d.ts +0 -7
  70. package/dist/game/ui/score-display.d.ts.map +0 -1
  71. package/dist/game/ui/score-display.js +0 -19
  72. package/dist/game/ui/score-display.js.map +0 -1
  73. package/dist/index.d.ts.map +0 -1
  74. package/dist/index.js.map +0 -1
  75. package/dist/pac-man.d.ts +0 -2
  76. package/dist/pac-man.d.ts.map +0 -1
  77. package/dist/pac-man.js +0 -19
  78. package/dist/pac-man.js.map +0 -1
@@ -1,25 +0,0 @@
1
- import { Ghost } from './ghost';
2
- import { directions } from '../../constants';
3
- export class Blinky extends Ghost {
4
- constructor(scene, gameMap, pacman, scatterTarget) {
5
- const x = 14 * 32;
6
- const y = 11 * 32 + 16;
7
- super(scene, gameMap, x, y, scatterTarget, pacman, 'blinky', [
8
- directions.UP,
9
- directions.RIGHT,
10
- directions.DOWN,
11
- directions.LEFT,
12
- ]);
13
- this.pelletCountToLeaveHouse = 0;
14
- this.timerToLeaveHouse = 0; // milliseconds
15
- this.randomId = Math.random().toString(36).substring(2, 15);
16
- this.setStartTimer();
17
- this.setFrame('blinky-left');
18
- }
19
- // Blinky always chases Pac-Man directly
20
- onCenter() {
21
- this.target = this.pacman.gridPosition;
22
- super.onCenter();
23
- }
24
- }
25
- //# sourceMappingURL=blinky.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blinky.js","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/blinky.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,MAAO,SAAQ,KAAK;IAM/B,YACE,KAAmB,EACnB,OAAkB,EAClB,MAAiB,EACjB,aAA4C;QAE5C,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;QACjB,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA;QACtB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE;YAC3D,UAAU,CAAC,EAAE;YACb,UAAU,CAAC,KAAK;YAChB,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,IAAI;SAChB,CAAC,CAAA;QAlBe,4BAAuB,GAAG,CAAC,CAAA;QAC3B,sBAAiB,GAAG,CAAC,CAAA,CAAC,eAAe;QAExD,aAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAiBpD,IAAI,CAAC,aAAa,EAAE,CAAA;QACpB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;IAC9B,CAAC;IAED,wCAAwC;IACxC,QAAQ;QACN,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAA;QACtC,KAAK,CAAC,QAAQ,EAAE,CAAA;IAClB,CAAC;CACF"}
@@ -1,10 +0,0 @@
1
- import { PacManMap } from 'pac-man-map-generator';
2
- import { Ghost } from './ghost';
3
- import { Character } from '../characters/character';
4
- export declare class Clyde extends Ghost {
5
- protected readonly pelletCountToLeaveHouse = 60;
6
- protected readonly timerToLeaveHouse = 11000;
7
- constructor(scene: Phaser.Scene, gameMap: PacManMap, pacman: Character, scatterTarget: Phaser.Types.Math.Vector2Like);
8
- onCenter(): void;
9
- }
10
- //# sourceMappingURL=clyde.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clyde.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/clyde.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,qBAAa,KAAM,SAAQ,KAAK;IAC9B,SAAS,CAAC,QAAQ,CAAC,uBAAuB,MAAK;IAC/C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,SAAS;gBAG3C,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,SAAS,EACjB,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW;IAiB9C,QAAQ;CAWT"}
@@ -1,31 +0,0 @@
1
- import { Ghost } from './ghost';
2
- import { directions } from '../../constants';
3
- export class Clyde extends Ghost {
4
- constructor(scene, gameMap, pacman, scatterTarget) {
5
- const x = 15.25 * 32;
6
- const y = 13.5 * 32;
7
- super(scene, gameMap, x, y, scatterTarget, pacman, 'clyde', [
8
- directions.DOWN,
9
- directions.LEFT,
10
- directions.UP,
11
- directions.RIGHT,
12
- ]);
13
- this.pelletCountToLeaveHouse = 60;
14
- this.timerToLeaveHouse = 11000; // milliseconds
15
- this.setFrame('clyde-left');
16
- this.setStartTimer();
17
- }
18
- // Clyde always chases Pac-Man directly
19
- // However, if he gets within 8 tiles of Pac-Man, he will stop moving toward him
20
- // and instead target his "home" position in the bottom-left corner of the map
21
- onCenter() {
22
- this.target = this.pacman.gridPosition;
23
- const distance = Math.abs(this.gridPosition.x - this.pacman.gridPosition.x) +
24
- Math.abs(this.gridPosition.y - this.pacman.gridPosition.y);
25
- if (distance < 8) {
26
- this.target = this.scatterTarget;
27
- }
28
- super.onCenter();
29
- }
30
- }
31
- //# sourceMappingURL=clyde.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clyde.js","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/clyde.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,KAAM,SAAQ,KAAK;IAI9B,YACE,KAAmB,EACnB,OAAkB,EAClB,MAAiB,EACjB,aAA4C;QAE5C,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAA;QACpB,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAA;QACnB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;YAC1D,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,EAAE;YACb,UAAU,CAAC,KAAK;SACjB,CAAC,CAAA;QAhBe,4BAAuB,GAAG,EAAE,CAAA;QAC5B,sBAAiB,GAAG,KAAM,CAAA,CAAC,eAAe;QAgB3D,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;QAC3B,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,uCAAuC;IACvC,gFAAgF;IAChF,8EAA8E;IAC9E,QAAQ;QACN,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAA;QACtC,MAAM,QAAQ,GACZ,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;YAC1D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;QAC5D,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;YACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,CAAA;QAClC,CAAC;QAED,KAAK,CAAC,QAAQ,EAAE,CAAA;IAClB,CAAC;CACF"}
@@ -1,48 +0,0 @@
1
- import { PacManMap } from 'pac-man-map-generator';
2
- import { Character } from '../characters/character';
3
- export declare enum GhostState {
4
- CHASE = 0,
5
- SCATTER = 1,
6
- FRIGHTENED = 2,
7
- DEAD = 3
8
- }
9
- export declare abstract class Ghost extends Character {
10
- ghostState: GhostState;
11
- protected pelletCount: number;
12
- protected speed: number;
13
- protected readonly pacman: Character;
14
- protected readonly gameMap: PacManMap;
15
- protected readonly scatterTarget: Phaser.Types.Math.Vector2Like;
16
- protected target: Phaser.Types.Math.Vector2Like;
17
- private previousGridCoords;
18
- protected abstract readonly pelletCountToLeaveHouse: number;
19
- protected abstract readonly timerToLeaveHouse: number;
20
- private hasLeftHouse;
21
- private isLeavingHouse;
22
- private sequenceIndex;
23
- private sequenceTimer?;
24
- private frightenedTimer?;
25
- private modeSequences;
26
- private readonly directionPriority;
27
- private readonly defTextureMap;
28
- private readonly startingCoords;
29
- private frightenedTextureMap;
30
- private frightenedEndTextureMap;
31
- constructor(scene: Phaser.Scene, gameMap: PacManMap, x: number, y: number, scatterTarget: Phaser.Types.Math.Vector2Like, pacman: Character, ghostName: string, directionPriority: number[]);
32
- countPellet(): void;
33
- scare(): void;
34
- private startSequence;
35
- protected setStartTimer(): void;
36
- private leaveHouse;
37
- update(): void;
38
- onCenter(): void;
39
- handleDeath(): void;
40
- private reset;
41
- private getRandomDirection;
42
- private mapPathToTarget;
43
- private isAtIntersection;
44
- private checkForWall;
45
- static loadTextures(textures: Phaser.Textures.TextureManager): void;
46
- static loadAnimations(anims: Phaser.Animations.AnimationManager): void;
47
- }
48
- //# sourceMappingURL=ghost.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ghost.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/ghost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAQnD,oBAAY,UAAU;IACpB,KAAK,IAAA;IACL,OAAO,IAAA;IACP,UAAU,IAAA;IACV,IAAI,IAAA;CACL;AAED,8BAAsB,KAAM,SAAQ,SAAS;IAC3C,UAAU,EAAE,UAAU,C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CL,OAAO,CAAC,aAAa;IAoBrB,SAAS,CAAC,aAAa;IAMvB,OAAO,CAAC,UAAU;IAyBlB,MAAM;IA8BN,QAAQ;IA+BR,WAAW;IAkBX,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,eAAe;IA0CvB,OAAO,CAAC,gBAAgB;IAsBxB,OAAO,CAAC,YAAY;IAMpB,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc;IAwB5D,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,gBAAgB;CAWhE"}
@@ -1,323 +0,0 @@
1
- import { Character } from '../characters/character';
2
- import { directions, directionsArray, GHOST_SPEED, GHOST_SPEED_FRIGHTENED, } from '../../constants';
3
- export var GhostState;
4
- (function (GhostState) {
5
- GhostState[GhostState["CHASE"] = 0] = "CHASE";
6
- GhostState[GhostState["SCATTER"] = 1] = "SCATTER";
7
- GhostState[GhostState["FRIGHTENED"] = 2] = "FRIGHTENED";
8
- GhostState[GhostState["DEAD"] = 3] = "DEAD";
9
- })(GhostState || (GhostState = {}));
10
- export class Ghost extends Character {
11
- constructor(scene, gameMap, x, y, scatterTarget, pacman, ghostName, directionPriority) {
12
- const startingFrame = `frame:${ghostName}-up`;
13
- const textureMap = {
14
- [directions.LEFT]: `frame:${ghostName}-left`,
15
- [directions.RIGHT]: `frame:${ghostName}-right`,
16
- [directions.UP]: `frame:${ghostName}-up`,
17
- [directions.DOWN]: `frame:${ghostName}-down`,
18
- };
19
- super(scene, gameMap, x, y, textureMap, 'spritesheet', startingFrame);
20
- this.ghostState = GhostState.SCATTER;
21
- this.pelletCount = 0;
22
- this.speed = GHOST_SPEED;
23
- this.scatterTarget = {
24
- x: 0,
25
- y: 0,
26
- };
27
- this.target = { x: 0, y: 0 };
28
- this.previousGridCoords = { x: 0, y: 0 };
29
- this.hasLeftHouse = false;
30
- this.isLeavingHouse = false;
31
- this.sequenceIndex = 0;
32
- this.modeSequences = [
33
- { state: GhostState.SCATTER, duration: 5000 },
34
- { state: GhostState.CHASE, duration: 20000 },
35
- { state: GhostState.SCATTER, duration: 5000 },
36
- { state: GhostState.CHASE, duration: 20000 },
37
- { state: GhostState.SCATTER, duration: 5000 },
38
- { state: GhostState.CHASE, duration: 20000 },
39
- { state: GhostState.SCATTER, duration: 5000 },
40
- { state: GhostState.CHASE, duration: null }, // -1 means indefinite
41
- ];
42
- this.frightenedTextureMap = {
43
- [directions.LEFT]: 'frame:frightened',
44
- [directions.RIGHT]: 'frame:frightened',
45
- [directions.UP]: 'frame:frightened',
46
- [directions.DOWN]: 'frame:frightened',
47
- };
48
- this.frightenedEndTextureMap = {
49
- [directions.LEFT]: 'frightened-end',
50
- [directions.RIGHT]: 'frightened-end',
51
- [directions.UP]: 'frightened-end',
52
- [directions.DOWN]: 'frightened-end',
53
- };
54
- this.startingCoords = { x, y };
55
- this.directionPriority = directionPriority;
56
- this.previousGridCoords = this.gridPosition;
57
- this.defTextureMap = textureMap;
58
- this.pacman = pacman;
59
- this.gameMap = gameMap;
60
- this.scatterTarget = scatterTarget;
61
- this.frightenedTimer?.destroy();
62
- this.frightenedTimer = undefined;
63
- this.sequenceTimer?.destroy();
64
- this.sequenceTimer = undefined;
65
- this.sequenceIndex = 0;
66
- this.target = this.scatterTarget;
67
- }
68
- countPellet() {
69
- this.pelletCount++;
70
- if (this.pelletCount === this.pelletCountToLeaveHouse) {
71
- this.leaveHouse();
72
- }
73
- }
74
- scare() {
75
- this.ghostState = GhostState.FRIGHTENED;
76
- this.speed = GHOST_SPEED_FRIGHTENED;
77
- let newDirection = this.getOppositeDirection(this.direction);
78
- const canMoveInOppositeDirection = this.canMove(this.gridPosition, newDirection);
79
- if (!canMoveInOppositeDirection) {
80
- newDirection = this.getRandomDirection();
81
- }
82
- this.changeDirection(newDirection);
83
- this.textureMap = this.frightenedTextureMap;
84
- this.setFrame('frightened');
85
- this.sequenceTimer?.destroy();
86
- // Clear existing timer and set new one
87
- this.frightenedTimer?.destroy();
88
- this.frightenedTimer = this.scene.time.delayedCall(6000, () => {
89
- this.textureMap = this.frightenedEndTextureMap;
90
- this.anims.play('frightened-end', true);
91
- this.frightenedTimer = this.scene.time.delayedCall(2000, () => {
92
- this.speed = GHOST_SPEED;
93
- this.textureMap = this.defTextureMap;
94
- this.changeDirection(this.direction);
95
- this.startSequence();
96
- });
97
- });
98
- }
99
- startSequence() {
100
- if (this.sequenceIndex >= this.modeSequences.length) {
101
- return;
102
- }
103
- const sequence = this.modeSequences[this.sequenceIndex];
104
- this.ghostState = sequence.state;
105
- if (sequence.duration !== null) {
106
- this.sequenceTimer = this.scene.time.delayedCall(sequence.duration, () => {
107
- this.sequenceIndex++;
108
- this.startSequence();
109
- });
110
- }
111
- }
112
- // Ghosts start moving after a delay
113
- setStartTimer() {
114
- this.scene.time.delayedCall(this.timerToLeaveHouse, () => {
115
- this.leaveHouse();
116
- });
117
- }
118
- leaveHouse() {
119
- if (this.hasLeftHouse) {
120
- return;
121
- }
122
- this.hasLeftHouse = true;
123
- this.isLeavingHouse = true;
124
- const x = 14 * 32;
125
- const y = 11 * 32 + 16;
126
- if (this.x <= x) {
127
- this.changeDirection(directions.RIGHT);
128
- }
129
- else if (this.x >= x) {
130
- this.changeDirection(directions.LEFT);
131
- }
132
- else if (this.y >= y) {
133
- this.changeDirection(directions.UP);
134
- }
135
- else {
136
- this.gridPosition = { x: 14, y: 11 };
137
- this.previousGridCoords = this.gridPosition;
138
- this.mapPathToTarget(this.target);
139
- this.isLeavingHouse = false;
140
- this.startSequence();
141
- }
142
- }
143
- update() {
144
- // If the ghost is still in the house, do nothing
145
- if (!this.hasLeftHouse) {
146
- return;
147
- }
148
- if (this.isLeavingHouse) {
149
- const targetX = 14 * 32;
150
- const targetY = 11 * 32 + 16;
151
- if (this.direction === directions.UP && this.y <= targetY) {
152
- this.gridPosition = { x: 14, y: 11 };
153
- this.previousGridCoords = this.gridPosition;
154
- this.isLeavingHouse = false;
155
- this.setPosition(targetX, targetY);
156
- this.mapPathToTarget(this.target);
157
- this.startSequence();
158
- }
159
- else if ((this.direction === directions.RIGHT && this.x >= targetX) ||
160
- (this.direction === directions.LEFT && this.x <= targetX)) {
161
- this.setPosition(targetX, this.y);
162
- this.changeDirection(directions.UP);
163
- }
164
- return;
165
- }
166
- super.update();
167
- }
168
- onCenter() {
169
- const newCoords = this.gridPosition;
170
- // Only recalculate path if the ghost has moved to a new grid square
171
- if (newCoords.x === this.previousGridCoords.x &&
172
- newCoords.y === this.previousGridCoords.y) {
173
- return;
174
- }
175
- this.previousGridCoords = newCoords;
176
- if (this.direction === -1 || this.isAtIntersection()) {
177
- // Target for GhostState.CHASE is handled in subclasses
178
- switch (this.ghostState) {
179
- case GhostState.SCATTER:
180
- this.target = this.scatterTarget;
181
- break;
182
- case GhostState.FRIGHTENED:
183
- this.changeDirection(this.getRandomDirection());
184
- return;
185
- }
186
- this.mapPathToTarget(this.target);
187
- return;
188
- }
189
- this.checkForWall();
190
- }
191
- handleDeath() {
192
- if (this.body) {
193
- this.body.stop();
194
- this.body.enable = false;
195
- }
196
- this.setAlpha(0);
197
- this.speed = 0;
198
- this.ghostState = GhostState.DEAD;
199
- this.scene.time.delayedCall(3000, () => {
200
- this.setAlpha(1);
201
- if (this.body) {
202
- this.body.enable = true;
203
- }
204
- this.reset();
205
- });
206
- }
207
- reset() {
208
- // Stop all timers
209
- this.frightenedTimer?.destroy();
210
- this.sequenceTimer?.destroy();
211
- // Reset state
212
- this.ghostState = GhostState.SCATTER;
213
- this.speed = GHOST_SPEED;
214
- this.hasLeftHouse = false;
215
- this.isLeavingHouse = false;
216
- this.textureMap = this.defTextureMap;
217
- // Reset position to spawn
218
- this.setPosition(this.startingCoords.x, this.startingCoords.y);
219
- this.gridPosition = {
220
- x: Math.floor(this.startingCoords.x / 32),
221
- y: Math.floor(this.startingCoords.y / 32),
222
- };
223
- this.previousGridCoords = this.gridPosition;
224
- this.direction = -1;
225
- // Restart house timer
226
- this.setStartTimer();
227
- }
228
- getRandomDirection() {
229
- const possibleDirections = directionsArray.filter((d) => d.dir !== this.getOppositeDirection(this.direction));
230
- const validDirections = possibleDirections.filter((d) => {
231
- const newX = this.previousGridCoords.x + d.x;
232
- const newY = this.previousGridCoords.y + d.y;
233
- return (this.gameMap[newY]?.[newX]?.type !== 'wall' &&
234
- this.gameMap[newY]?.[newX]?.type !== 'ghost-house');
235
- });
236
- if (validDirections.length === 0) {
237
- return this.getOppositeDirection(this.direction);
238
- }
239
- return Phaser.Utils.Array.GetRandom(validDirections).dir;
240
- }
241
- mapPathToTarget(target) {
242
- // Calculate the shortest distance from
243
- // each surrounding square to the target
244
- // excluding the back wards direction
245
- const directionsToCheck = this.directionPriority
246
- .filter((d) => d !== this.getOppositeDirection(this.direction))
247
- .map((dir) => {
248
- return directionsArray.find((d) => d.dir === dir);
249
- })
250
- .filter((d) => d !== undefined);
251
- let shortestDistance = Infinity;
252
- let bestDirection = this.direction;
253
- directionsToCheck.forEach((d) => {
254
- const newX = this.gridPosition.x + d.x;
255
- const newY = this.gridPosition.y + d.y;
256
- const block = this.gameMap[newY]?.[newX];
257
- if (block &&
258
- this.gameMap[newY]?.[newX]?.type !== 'wall' &&
259
- this.gameMap[newY]?.[newX]?.type !== 'ghost-house') {
260
- const distance = Math.hypot(target.x - newX, target.y - newY);
261
- if (distance < shortestDistance) {
262
- shortestDistance = distance;
263
- bestDirection = d.dir;
264
- }
265
- else if (distance === shortestDistance &&
266
- bestDirection === this.direction) {
267
- // If distances are equal, prefer to keep moving in the same direction
268
- bestDirection = d.dir;
269
- }
270
- }
271
- });
272
- // Move in the best direction
273
- this.changeDirection(bestDirection);
274
- }
275
- isAtIntersection() {
276
- const cell = {
277
- x: Math.floor(this.position.x / 32),
278
- y: Math.floor(this.position.y / 32),
279
- };
280
- let paths = 0;
281
- directionsArray.forEach((dir) => {
282
- const newX = cell.x + dir.x;
283
- const newY = cell.y + dir.y;
284
- if (this.gameMap[newY]?.[newX]?.type !== 'wall' &&
285
- this.gameMap[newY]?.[newX]?.type !== 'ghost-house') {
286
- paths++;
287
- }
288
- });
289
- return paths > 2;
290
- }
291
- checkForWall() {
292
- if (!this.canMove(this.previousGridCoords, this.direction)) {
293
- this.mapPathToTarget(this.target);
294
- }
295
- }
296
- static loadTextures(textures) {
297
- const tex = textures.get('spritesheet');
298
- const ghosts = ['blinky', 'pinky', 'inky', 'clyde', 'eyes'];
299
- const spriteMaps = [];
300
- for (let i = 0; i < ghosts.length; i++) {
301
- const ghost = ghosts[i];
302
- spriteMaps.push({ key: `${ghost}-up`, xPos: i * 2, yPos: 4 }, { key: `${ghost}-down`, xPos: i * 2, yPos: 6 }, { key: `${ghost}-left`, xPos: i * 2, yPos: 8 }, { key: `${ghost}-right`, xPos: i * 2, yPos: 10 });
303
- }
304
- spriteMaps.push({ key: `frightened`, xPos: 10, yPos: 4 });
305
- spriteMaps.push({ key: `frightened-flash`, xPos: 10, yPos: 6 });
306
- for (let i = 0; i < spriteMaps.length; i++) {
307
- const { key, xPos, yPos } = spriteMaps[i];
308
- tex.add(key, 0, xPos * 16, yPos * 16, 32, 32);
309
- }
310
- }
311
- static loadAnimations(anims) {
312
- anims.create({
313
- key: 'frightened-end',
314
- frames: [
315
- { key: 'spritesheet', frame: 'frightened-flash' },
316
- { key: 'spritesheet', frame: 'frightened' },
317
- ],
318
- repeat: -1,
319
- frameRate: 5,
320
- });
321
- }
322
- }
323
- //# sourceMappingURL=ghost.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ghost.js","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/ghost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EACL,UAAU,EACV,eAAe,EACf,WAAW,EACX,sBAAsB,GACvB,MAAM,iBAAiB,CAAA;AAExB,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,6CAAK,CAAA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-man-map-generator';
2
- import { Ghost } from './ghost';
3
- import { Character } from '../characters/character';
4
- export declare class Inky extends Ghost {
5
- protected readonly pelletCountToLeaveHouse = 30;
6
- protected readonly timerToLeaveHouse = 5000;
7
- private readonly blinky;
8
- constructor(scene: Phaser.Scene, gameMap: PacManMap, pacman: Character, blinky: Character, scatterTarget: Phaser.Types.Math.Vector2Like);
9
- onCenter(): void;
10
- }
11
- //# sourceMappingURL=inky.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inky.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/inky.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,qBAAa,IAAK,SAAQ,KAAK;IAC7B,SAAS,CAAC,QAAQ,CAAC,uBAAuB,MAAK;IAC/C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,QAAO;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEhC,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,EACjB,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW;IAmB9C,QAAQ;CA6BT"}
@@ -1,50 +0,0 @@
1
- import { Ghost } from './ghost';
2
- import { directions } from '../../constants';
3
- export class Inky extends Ghost {
4
- constructor(scene, gameMap, pacman, blinky, scatterTarget) {
5
- const x = 12.75 * 32;
6
- const y = 13.5 * 32;
7
- super(scene, gameMap, x, y, scatterTarget, pacman, 'inky', [
8
- directions.RIGHT,
9
- directions.DOWN,
10
- directions.LEFT,
11
- directions.UP,
12
- ]);
13
- this.pelletCountToLeaveHouse = 30;
14
- this.timerToLeaveHouse = 5000; // milliseconds
15
- this.blinky = blinky;
16
- this.setFrame('inky-right');
17
- this.setStartTimer();
18
- }
19
- // Inky tries to position itself based on both Blinky's and Pac-Man's positions
20
- // First, it picks a tile two spaces in front of Pac-Man
21
- // Then, it draws a vector from Blinky to that tile and doubles it
22
- // Inky then targets the end of that new vector
23
- onCenter() {
24
- this.target = this.pacman.gridPosition;
25
- switch (this.pacman.direction) {
26
- case directions.LEFT:
27
- this.target.x -= 2;
28
- break;
29
- case directions.UP:
30
- // The original Pac-Man had a bug
31
- // where if Pac-Man was facing up,
32
- // then Inky actually targeted 2 tiles up and 2 tiles left
33
- this.target.x -= 2;
34
- this.target.y -= 2;
35
- break;
36
- case directions.RIGHT:
37
- this.target.x += 2;
38
- break;
39
- case directions.DOWN:
40
- this.target.y += 2;
41
- break;
42
- }
43
- const vectorX = (this.target.x - this.blinky.gridPosition.x) * 2;
44
- const vectorY = (this.target.y - this.blinky.gridPosition.y) * 2;
45
- this.target.x += vectorX;
46
- this.target.y += vectorY;
47
- super.onCenter();
48
- }
49
- }
50
- //# sourceMappingURL=inky.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inky.js","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/inky.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,IAAK,SAAQ,KAAK;IAI7B,YACE,KAAmB,EACnB,OAAkB,EAClB,MAAiB,EACjB,MAAiB,EACjB,aAA4C;QAE5C,MAAM,CAAC,GAAG,KAAK,GAAG,EAAE,CAAA;QACpB,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAA;QACnB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE;YACzD,UAAU,CAAC,KAAK;YAChB,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,IAAI;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IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,OAAO,CAAA;QACxB,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,OAAO,CAAA;QAExB,KAAK,CAAC,QAAQ,EAAE,CAAA;IAClB,CAAC;CACF"}
@@ -1,10 +0,0 @@
1
- import { PacManMap } from 'pac-man-map-generator';
2
- import { Ghost } from './ghost';
3
- import { Character } from '../characters/character';
4
- export declare class Pinky extends Ghost {
5
- protected readonly pelletCountToLeaveHouse = 0;
6
- protected readonly timerToLeaveHouse = 0;
7
- constructor(scene: Phaser.Scene, gameMap: PacManMap, pacman: Character, scatterTarget: Phaser.Types.Math.Vector2Like);
8
- onCenter(): void;
9
- }
10
- //# sourceMappingURL=pinky.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinky.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/pinky.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,qBAAa,KAAM,SAAQ,KAAK;IAC9B,SAAS,CAAC,QAAQ,CAAC,uBAAuB,KAAI;IAC9C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,KAAI;gBAEtC,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,SAAS,EACjB,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW;IAgB9C,QAAQ;CAwBT"}
@@ -1,42 +0,0 @@
1
- import { Ghost } from './ghost';
2
- import { directions } from '../../constants';
3
- export class Pinky extends Ghost {
4
- constructor(scene, gameMap, pacman, scatterTarget) {
5
- const x = 14 * 32;
6
- const y = 13.5 * 32;
7
- super(scene, gameMap, x, y, scatterTarget, pacman, 'pinky', [
8
- directions.UP,
9
- directions.LEFT,
10
- directions.DOWN,
11
- directions.RIGHT,
12
- ]);
13
- this.pelletCountToLeaveHouse = 0;
14
- this.timerToLeaveHouse = 0; // milliseconds
15
- this.setFrame('pinky-up');
16
- this.setStartTimer();
17
- }
18
- // Pinky tries to position itself 4 tiles ahead of Pac-Man
19
- onCenter() {
20
- this.target = this.pacman.gridPosition;
21
- switch (this.pacman.direction) {
22
- case directions.LEFT:
23
- this.target.x -= 4;
24
- break;
25
- case directions.UP:
26
- // The original Pac-Man had a bug
27
- // where if Pac-Man was facing up,
28
- // then Pinky actually targeted 4 tiles up and 4 tiles left
29
- this.target.y -= 4;
30
- this.target.x -= 4;
31
- break;
32
- case directions.RIGHT:
33
- this.target.x += 4;
34
- break;
35
- case directions.DOWN:
36
- this.target.y += 4;
37
- break;
38
- }
39
- super.onCenter();
40
- }
41
- }
42
- //# sourceMappingURL=pinky.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinky.js","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/pinky.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAO,KAAM,SAAQ,KAAK;IAG9B,YACE,KAAmB,EACnB,OAAkB,EAClB,MAAiB,EACjB,aAA4C;QAE5C,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;QACjB,MAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAA;QACnB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;YAC1D,UAAU,CAAC,EAAE;YACb,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,IAAI;YACf,UAAU,CAAC,KAAK;SACjB,CAAC,CAAA;QAfe,4BAAuB,GAAG,CAAC,CAAA;QAC3B,sBAAiB,GAAG,CAAC,CAAA,CAAC,eAAe;QAgBtD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QACzB,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC;IAED,0DAA0D;IAC1D,QAAQ;QACN,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAA;QAEtC,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC9B,KAAK,UAAU,CAAC,IAAI;gBAClB,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;gBAClB,MAAK;YACP,KAAK,UAAU,CAAC,EAAE;gBAChB,iCAAiC;gBACjC,kCAAkC;gBAClC,2DAA2D;gBAC3D,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;gBAClB,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;gBAClB,MAAK;YACP,KAAK,UAAU,CAAC,KAAK;gBACnB,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;gBAClB,MAAK;YACP,KAAK,UAAU,CAAC,IAAI;gBAClB,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;gBAClB,MAAK;QACT,CAAC;QAED,KAAK,CAAC,QAAQ,EAAE,CAAA;IAClB,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- import { PacManMap } from 'pac-man-map-generator/dist/types';
2
- import { Character } from './characters/character';
3
- export declare class Pacman extends Character {
4
- private nextDir;
5
- private eatCoords;
6
- protected speed: number;
7
- private hasMoved;
8
- constructor(scene: Phaser.Scene, gameMap: PacManMap);
9
- handleDeath(): void;
10
- update(): void;
11
- eatPellet(x: number, y: number): void;
12
- protected onCenter(cell: Phaser.Types.Math.Vector2Like): void;
13
- private setEventListeners;
14
- static loadTextures(textures: Phaser.Textures.TextureManager): void;
15
- static loadAnimations(anims: Phaser.Animations.AnimationManager): void;
16
- }
17
- //# sourceMappingURL=pac-man.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pac-man.d.ts","sourceRoot":"","sources":["../../../src/game/sprites/pac-man.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAO5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD,qBAAa,MAAO,SAAQ,SAAS;IACnC,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,SAAS,CAAsB;IACvC,SAAS,CAAC,KAAK,SAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAiB;gBAErB,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS;IAkBnD,WAAW;IAWX,MAAM;IAWN,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAI9B,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW;IA4BtD,OAAO,CAAC,iBAAiB;IA2BzB,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc;IA+G5D,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,gBAAgB;CAoEhE"}