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
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "pac-man-phaser",
3
3
  "type": "module",
4
- "version": "1.0.9",
4
+ "version": "1.0.10",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
- "dist",
9
- "dist/assets"
8
+ "dist"
10
9
  ],
11
10
  "exports": {
12
11
  ".": {
@@ -15,8 +14,8 @@
15
14
  }
16
15
  },
17
16
  "scripts": {
18
- "build": "tsc && cp -r assets dist",
19
- "dev": "cp -r assets dist && tsc --watch",
17
+ "build": "tsup",
18
+ "dev": "tsup --watch",
20
19
  "lint": "eslint ./src --fix",
21
20
  "patch": "npm version patch --no-git-tag-version",
22
21
  "prepublishOnly": "npm run build"
Binary file
@@ -1,9 +0,0 @@
1
- type GameOverData = {
2
- score: number;
3
- };
4
- export declare class GameOverScene extends Phaser.Scene {
5
- constructor();
6
- create({ score }: GameOverData): void;
7
- }
8
- export {};
9
- //# sourceMappingURL=game-over-scene.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"game-over-scene.d.ts","sourceRoot":"","sources":["../../../src/game/_scenes/game-over-scene.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,qBAAa,aAAc,SAAQ,MAAM,CAAC,KAAK;;IAK7C,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,YAAY;CA0D/B"}
@@ -1,59 +0,0 @@
1
- export class GameOverScene extends Phaser.Scene {
2
- constructor() {
3
- super({ key: 'GameOverScene' });
4
- }
5
- create({ score }) {
6
- const { width, height } = this.scale;
7
- this.add
8
- .text(width / 2, height / 2 - 40, 'Game Over!', {
9
- fontSize: '32px',
10
- color: '#fff',
11
- shadow: {
12
- offsetX: 2,
13
- offsetY: 2,
14
- color: '#000',
15
- blur: 10,
16
- fill: true,
17
- },
18
- })
19
- .setOrigin(0.5);
20
- this.add
21
- .text(width / 2, height / 2, `Final Score: ${score}`, {
22
- fontSize: '32px',
23
- color: '#fff',
24
- shadow: {
25
- offsetX: 2,
26
- offsetY: 2,
27
- color: '#000',
28
- blur: 10,
29
- fill: true,
30
- },
31
- })
32
- .setOrigin(0.5);
33
- const restart = () => {
34
- this.scene.stop(); // Stop GameOverScene
35
- // Get reference to PacManScene and restart it
36
- const pacManScene = this.scene.get('PacManScene');
37
- if (pacManScene) {
38
- pacManScene.scene.restart(); // This creates a fresh instance
39
- }
40
- };
41
- this.add
42
- .text(width / 2, height / 2 + 40, 'Restart', {
43
- fontSize: '24px',
44
- color: '#fff',
45
- padding: { x: 10, y: 5 },
46
- shadow: {
47
- offsetX: 2,
48
- offsetY: 2,
49
- color: '#000',
50
- blur: 10,
51
- fill: true,
52
- },
53
- })
54
- .setOrigin(0.5)
55
- .setInteractive({ useHandCursor: true })
56
- .on('pointerdown', restart);
57
- }
58
- }
59
- //# sourceMappingURL=game-over-scene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"game-over-scene.js","sourceRoot":"","sources":["../../../src/game/_scenes/game-over-scene.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK;IAC7C;QACE,KAAK,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,CAAC,CAAA;IACjC,CAAC;IAED,MAAM,CAAC,EAAE,KAAK,EAAgB;QAC5B,MAAM,EAAE,KAAK,EAAE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ACb,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;YACxB,MAAM,EAAE;gBACN,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,CAAC;gBACV,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,IAAI;aACX;SACF,CAAC;aACD,SAAS,CAAC,GAAG,CAAC;aACd,cAAc,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;aACvC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAC/B,CAAC;CACF"}
@@ -1,14 +0,0 @@
1
- import { Scene } from 'phaser';
2
- export declare class PacManScene extends Scene {
3
- private pacman;
4
- private ghosts;
5
- private scoreDisplay;
6
- private gameOver;
7
- constructor();
8
- preload(): void;
9
- create(): void;
10
- update(): void;
11
- private createGraphics;
12
- }
13
- export declare function createPacManScene(container: HTMLDivElement): Phaser.Game;
14
- //# sourceMappingURL=pac-man-scene.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pac-man-scene.d.ts","sourceRoot":"","sources":["../../../src/game/_scenes/pac-man-scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAgB9B,qBAAa,WAAY,SAAQ,KAAK;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAiB;;IAMjC,OAAO;IAYP,MAAM;IA2GN,MAAM,IAAI,IAAI;IAWd,OAAO,CAAC,cAAc;CASvB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,cAAc,eAsB1D"}
@@ -1,155 +0,0 @@
1
- import { Scene } from 'phaser';
2
- import { Wall } from '../sprites/wall';
3
- import { generateMap } from 'pac-man-map-generator';
4
- import { Pellet } from '../sprites/pellet';
5
- import { Pacman } from '../sprites/pac-man';
6
- import { ScoreDisplay } from '../ui/score-display';
7
- import { SuperPellet } from '../sprites/super-pellet';
8
- import { Item } from '../sprites/abstracts/item';
9
- import { Ghost, GhostState } from '../sprites/ghosts/ghost';
10
- import { PauseMenu } from './pause-scene';
11
- import { Blinky } from '../sprites/ghosts/blinky';
12
- import { Clyde } from '../sprites/ghosts/clyde';
13
- import { Inky } from '../sprites/ghosts/inky';
14
- import { Pinky } from '../sprites/ghosts/pinky';
15
- import { GameOverScene } from './game-over-scene';
16
- export class PacManScene extends Scene {
17
- constructor() {
18
- super('PacManScene');
19
- this.ghosts = [];
20
- this.gameOver = false;
21
- }
22
- preload() {
23
- let basePath = import.meta.url;
24
- const index = basePath.lastIndexOf('/game/');
25
- if (index !== -1) {
26
- basePath = basePath.substring(0, index + 6);
27
- }
28
- const spriteSheet = new URL('../assets/spritesheet.webp', basePath).href;
29
- this.load.image('spritesheet', spriteSheet);
30
- }
31
- create() {
32
- this.gameOver = false;
33
- this.physics.world.colliders.destroy();
34
- // Pause functionality
35
- this.input.keyboard?.on('keydown-P', () => {
36
- this.scene.pause();
37
- this.scene.launch('PauseMenu');
38
- });
39
- this.events.on('game-over', () => {
40
- this.gameOver = true;
41
- this.physics.pause();
42
- this.scene.launch('GameOverScene', {
43
- score: this.scoreDisplay.getScore(),
44
- });
45
- });
46
- this.createGraphics();
47
- const map = generateMap();
48
- const items = this.physics.add.staticGroup();
49
- const fourCorners = SuperPellet.getFourCorners(map);
50
- map.forEach((row, y) => {
51
- row.forEach((block, x) => {
52
- if (block?.type === 'wall') {
53
- new Wall(this, x, y);
54
- }
55
- else if (block?.type === 'empty' && (x !== 14 || y !== 19)) {
56
- // Place super pellets in the four corners
57
- if (fourCorners.some((corner) => corner.x === x && corner.y === y)) {
58
- items.add(new SuperPellet(this, x, y));
59
- return;
60
- }
61
- const surroundingBlocks = [
62
- map[y - 1]?.[x], // Up
63
- map[y + 1]?.[x], // Down
64
- map[y]?.[x - 1], // Left
65
- map[y]?.[x + 1], // Right
66
- map[y - 1]?.[x - 1], // Up-Left
67
- map[y - 1]?.[x + 1], // Up-Right
68
- map[y + 1]?.[x - 1], // Down-Left
69
- map[y + 1]?.[x + 1], // Down-Right
70
- ];
71
- // No pellets in the ghost house or next to it
72
- if (surroundingBlocks.some((b) => b?.type === 'ghost-house')) {
73
- return;
74
- }
75
- items.add(new Pellet(this, x, y));
76
- }
77
- });
78
- });
79
- const ghostCollisionGroup = this.physics.add.group([]);
80
- this.pacman = new Pacman(this, map);
81
- ghostCollisionGroup.add(this.pacman);
82
- this.scoreDisplay = new ScoreDisplay(this, 4, 4);
83
- this.physics.add.overlap(this.pacman, items, (_pacman, item) => {
84
- if (!(item instanceof Item)) {
85
- return;
86
- }
87
- if (item instanceof SuperPellet) {
88
- this.ghosts.forEach((ghost) => ghost.scare());
89
- }
90
- this.scoreDisplay.addPoints(item.points);
91
- item.destroy();
92
- this.pacman.eatPellet(item.coords.x, item.coords.y);
93
- this.ghosts.forEach((ghost) => ghost.countPellet());
94
- }, undefined, this);
95
- //Ghosts
96
- // Corner order: top-left, top-right, bottom-left, bottom-right
97
- const blinky = new Blinky(this, map, this.pacman, fourCorners[1]);
98
- this.ghosts.push(new Pinky(this, map, this.pacman, fourCorners[0]), blinky, new Clyde(this, map, this.pacman, fourCorners[2]));
99
- // Inky needs a reference to Blinky to determine its target
100
- this.ghosts.push(new Inky(this, map, this.pacman, blinky, fourCorners[3]));
101
- this.ghosts.forEach((ghost) => ghostCollisionGroup.add(ghost));
102
- this.physics.add.overlap(this.pacman, ghostCollisionGroup, (_, o2) => {
103
- const ghost = o2;
104
- if (ghost.ghostState === GhostState.FRIGHTENED) {
105
- this.scoreDisplay.addPoints(200);
106
- ghost.handleDeath();
107
- }
108
- else {
109
- this.pacman.handleDeath();
110
- }
111
- });
112
- }
113
- update() {
114
- if (this.gameOver) {
115
- return;
116
- }
117
- this.pacman.update();
118
- this.ghosts.forEach((ghost) => {
119
- if (ghost.ghostState !== GhostState.DEAD)
120
- ghost.update();
121
- });
122
- }
123
- createGraphics() {
124
- Pacman.loadTextures(this.textures);
125
- Pacman.loadAnimations(this.anims);
126
- Ghost.loadTextures(this.textures);
127
- Ghost.loadAnimations(this.anims);
128
- Wall.addWallGraphics(this);
129
- Pellet.addPelletGraphics(this);
130
- SuperPellet.addSuperPelletGraphics(this);
131
- }
132
- }
133
- export function createPacManScene(container) {
134
- const config = {
135
- type: Phaser.AUTO,
136
- parent: container,
137
- backgroundColor: '#5e5f60ff',
138
- width: 896,
139
- height: 992,
140
- physics: {
141
- default: 'arcade',
142
- arcade: {
143
- gravity: { x: 0, y: 0 },
144
- debug: false,
145
- },
146
- },
147
- scale: {
148
- mode: Phaser.Scale.FIT,
149
- autoCenter: Phaser.Scale.CENTER_BOTH,
150
- },
151
- scene: [PacManScene, PauseMenu, GameOverScene],
152
- };
153
- return new Phaser.Game(config);
154
- }
155
- //# sourceMappingURL=pac-man-scene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pac-man-scene.js","sourceRoot":"","sources":["../../../src/game/_scenes/pac-man-scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B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AAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAChC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;QAC1B,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAC9B,WAAW,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAA;IAC1C,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,MAAM,MAAM,GAAiC;QAC3C,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,WAAW;QAC5B,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE;gBACN,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;gBACvB,KAAK,EAAE,KAAK;aACb;SACF;QACD,KAAK,EAAE;YACL,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG;YACtB,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW;SACrC;QACD,KAAK,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,aAAa,CAAC;KAC/C,CAAA;IAED,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare class PauseMenu extends Phaser.Scene {
2
- constructor();
3
- create(): void;
4
- }
5
- //# sourceMappingURL=pause-scene.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pause-scene.d.ts","sourceRoot":"","sources":["../../../src/game/_scenes/pause-scene.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,MAAM,CAAC,KAAK;;IAKzC,MAAM;CA0BP"}
@@ -1,28 +0,0 @@
1
- export class PauseMenu extends Phaser.Scene {
2
- constructor() {
3
- super({ key: 'PauseMenu' });
4
- }
5
- create() {
6
- const { width, height } = this.scale;
7
- this.add
8
- .text(width / 2, height / 2 - 40, 'Game Paused', {
9
- fontSize: '32px',
10
- color: '#fff',
11
- })
12
- .setOrigin(0.5);
13
- const resumeButton = this.add
14
- .text(width / 2, height / 2, 'Resume', {
15
- fontSize: '24px',
16
- color: '#0f0',
17
- })
18
- .setOrigin(0.5)
19
- .setInteractive();
20
- const resume = () => {
21
- this.scene.stop(); // close pause menu
22
- this.scene.resume('PacManScene'); // resume game
23
- };
24
- resumeButton.on('pointerdown', resume);
25
- this.input.keyboard?.on('keydown-P', resume);
26
- }
27
- }
28
- //# sourceMappingURL=pause-scene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pause-scene.js","sourceRoot":"","sources":["../../../src/game/_scenes/pause-scene.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,SAAU,SAAQ,MAAM,CAAC,KAAK;IACzC;QACE,KAAK,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEpC,IAAI,CAAC,GAAG;aACL,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE;YAC/C,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,MAAM;SACd,CAAC;aACD,SAAS,CAAC,GAAG,CAAC,CAAA;QAEjB,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG;aAC1B,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE;YACrC,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,MAAM;SACd,CAAC;aACD,SAAS,CAAC,GAAG,CAAC;aACd,cAAc,EAAE,CAAA;QAEnB,MAAM,MAAM,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA,CAAC,mBAAmB;YACrC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA,CAAC,cAAc;QACjD,CAAC,CAAA;QAED,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QACtC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;IAC9C,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- export declare const directions: {
2
- LEFT: number;
3
- RIGHT: number;
4
- UP: number;
5
- DOWN: number;
6
- };
7
- export declare const directionsArray: {
8
- x: number;
9
- y: number;
10
- dir: number;
11
- }[];
12
- export declare const BASE_SPEED = 120;
13
- export declare const PAC_MAN_SPEED = 120;
14
- export declare const PAC_MAN_SPEED_SCATTER: number;
15
- export declare const PAC_MAN_SPEED_EATING: number;
16
- export declare const PAC_MAN_SPEED_TUNNEL: number;
17
- export declare const GHOST_SPEED: number;
18
- export declare const GHOST_SPEED_FRIGHTENED: number;
19
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/game/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;CAKtB,CAAA;AAED,eAAO,MAAM,eAAe;;;;GAK3B,CAAA;AAGD,eAAO,MAAM,UAAU,MAAM,CAAA;AAG7B,eAAO,MAAM,aAAa,MAAa,CAAA;AAGvC,eAAO,MAAM,qBAAqB,QAAoB,CAAA;AAGtD,eAAO,MAAM,oBAAoB,QAAmB,CAAA;AAGpD,eAAO,MAAM,oBAAoB,QAAmB,CAAA;AAGpD,eAAO,MAAM,WAAW,QAAsB,CAAA;AAG9C,eAAO,MAAM,sBAAsB,QAAqB,CAAA"}
@@ -1,27 +0,0 @@
1
- export const directions = {
2
- LEFT: 0,
3
- RIGHT: 1,
4
- UP: 2,
5
- DOWN: 3,
6
- };
7
- export const directionsArray = [
8
- { x: 0, y: -1, dir: directions.UP },
9
- { x: 0, y: 1, dir: directions.DOWN },
10
- { x: -1, y: 0, dir: directions.LEFT },
11
- { x: 1, y: 0, dir: directions.RIGHT },
12
- ];
13
- // 2px per second base speed
14
- export const BASE_SPEED = 120;
15
- // 100% speed for pac-man
16
- export const PAC_MAN_SPEED = BASE_SPEED;
17
- // 125% speed for pac-man in scatter mode
18
- export const PAC_MAN_SPEED_SCATTER = BASE_SPEED * 1.25;
19
- // 90% while eating
20
- export const PAC_MAN_SPEED_EATING = BASE_SPEED * 0.9;
21
- // 50% speed when going through tunnels
22
- export const PAC_MAN_SPEED_TUNNEL = BASE_SPEED * 0.5;
23
- // 93.75% speed for ghosts
24
- export const GHOST_SPEED = BASE_SPEED * 0.9375;
25
- // 62.5% speed for frightened ghosts
26
- export const GHOST_SPEED_FRIGHTENED = BASE_SPEED * 0.625;
27
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/game/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,EAAE,EAAE,CAAC;IACL,IAAI,EAAE,CAAC;CACR,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE;IACnC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE;IACpC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE;IACrC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE;CACtC,CAAA;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;AAE7B,yBAAyB;AACzB,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAA;AAEvC,yCAAyC;AACzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,GAAG,IAAI,CAAA;AAEtD,mBAAmB;AACnB,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,GAAG,GAAG,CAAA;AAEpD,uCAAuC;AACvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,GAAG,GAAG,CAAA;AAEpD,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAE9C,oCAAoC;AACpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,GAAG,KAAK,CAAA"}
@@ -1,5 +0,0 @@
1
- import { Item } from './item';
2
- export declare abstract class ActionItem extends Item {
3
- abstract onCollect(): void;
4
- }
5
- //# sourceMappingURL=action-item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-item.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/abstracts/action-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,8BAAsB,UAAW,SAAQ,IAAI;IAC3C,QAAQ,CAAC,SAAS,IAAI,IAAI;CAC3B"}
@@ -1,4 +0,0 @@
1
- import { Item } from './item';
2
- export class ActionItem extends Item {
3
- }
4
- //# sourceMappingURL=action-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-item.js","sourceRoot":"","sources":["../../../../src/game/sprites/abstracts/action-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,OAAgB,UAAW,SAAQ,IAAI;CAE5C"}
@@ -1,6 +0,0 @@
1
- export declare abstract class Item extends Phaser.Physics.Arcade.Sprite {
2
- abstract readonly points: number;
3
- readonly coords: Phaser.Types.Math.Vector2Like;
4
- constructor(scene: Phaser.Scene, x: number, y: number, sizeOffset: number, texture: string);
5
- }
6
- //# sourceMappingURL=item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/abstracts/item.ts"],"names":[],"mappings":"AAAA,8BAAsB,IAAK,SAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;IAC7D,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IAEhC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;gBAG5C,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM;CAWlB"}
@@ -1,12 +0,0 @@
1
- export class Item extends Phaser.Physics.Arcade.Sprite {
2
- constructor(scene, x, y, sizeOffset, texture) {
3
- const adjustedX = x * 32 + sizeOffset;
4
- const adjustedY = y * 32 + sizeOffset;
5
- super(scene, adjustedX, adjustedY, texture);
6
- this.coords = { x, y };
7
- // Add to scene
8
- this.setOrigin(0, 0); // Top-left origin
9
- scene.add.existing(this);
10
- }
11
- }
12
- //# sourceMappingURL=item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../src/game/sprites/abstracts/item.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,IAAK,SAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;IAK7D,YACE,KAAmB,EACnB,CAAS,EACT,CAAS,EACT,UAAkB,EAClB,OAAe;QAEf,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,UAAU,CAAA;QACrC,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,UAAU,CAAA;QACrC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAEtB,eAAe;QACf,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,kBAAkB;QACvC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- import { PacManMap } from 'pac-man-map-generator';
2
- export declare abstract class Character extends Phaser.Physics.Arcade.Sprite {
3
- position: Phaser.Types.Math.Vector2Like;
4
- gridPosition: Phaser.Types.Math.Vector2Like;
5
- direction: number;
6
- protected readonly gameMap: PacManMap;
7
- protected abstract readonly speed: number;
8
- protected textureMap: Record<number, string>;
9
- constructor(scene: Phaser.Scene, gameMap: PacManMap, x: number, y: number, textureMap: Record<number, string>, texture: string, startingFrame?: string);
10
- update(): void;
11
- protected canMove(cell: {
12
- x: number;
13
- y: number;
14
- }, direction: number): boolean;
15
- protected changeDirection(direction: number): void;
16
- protected getOppositeDirection(direction: number): number;
17
- protected abstract onCenter(cell: Phaser.Types.Math.Vector2Like): void;
18
- abstract handleDeath(): void;
19
- }
20
- //# sourceMappingURL=character.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/characters/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGjD,8BAAsB,SAAU,SAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;IAClE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAiB;IACxD,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAiB;IAC5D,SAAS,EAAE,MAAM,CAAK;IACtB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;IACrC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IAEzC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAG1C,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,OAAO,EAAE,SAAS,EAClB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM;IAcxB,MAAM;IAwDN,SAAS,CAAC,OAAO,CACf,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAC9B,SAAS,EAAE,MAAM,GAChB,OAAO;IA6BV,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM;IA4B3C,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAezD,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI;IACtE,QAAQ,CAAC,WAAW,IAAI,IAAI;CAC7B"}
@@ -1,125 +0,0 @@
1
- import { directions } from '../../constants';
2
- export class Character extends Phaser.Physics.Arcade.Sprite {
3
- constructor(scene, gameMap, x, y, textureMap, texture, startingFrame) {
4
- super(scene, x, y, texture, startingFrame);
5
- this.position = { x: 0, y: 0 };
6
- this.gridPosition = { x: 0, y: 0 };
7
- this.direction = -1;
8
- this.gameMap = gameMap;
9
- this.position = { x, y };
10
- this.gridPosition = { x: Math.floor(x / 32), y: Math.floor(y / 32) };
11
- this.textureMap = textureMap;
12
- scene.add.existing(this);
13
- scene.physics.add.existing(this);
14
- this.setCollideWorldBounds(false);
15
- }
16
- update() {
17
- const cell = {
18
- x: Math.floor(this.x / 32),
19
- y: Math.floor(this.y / 32),
20
- };
21
- const center = {
22
- x: cell.x * 32 + 16,
23
- y: cell.y * 32 + 16,
24
- };
25
- const tolerance = 4;
26
- const inCenterX = Math.abs(this.x - center.x) < tolerance;
27
- const inCenterY = Math.abs(this.y - center.y) < tolerance;
28
- // Snap to center if not already there
29
- if ((this.direction === directions.RIGHT ||
30
- this.direction === directions.LEFT) &&
31
- !inCenterY) {
32
- this.setPosition(this.x, this.position.y);
33
- }
34
- if ((this.direction === directions.UP ||
35
- this.direction === directions.DOWN) &&
36
- !inCenterX) {
37
- this.setPosition(this.position.x, this.y);
38
- }
39
- // At cell center
40
- if (inCenterX && inCenterY) {
41
- this.position = center;
42
- this.gridPosition = cell;
43
- // Teleporting logic
44
- if (cell.x < -1) {
45
- this.setPosition(32 * 28, this.y);
46
- }
47
- else if (cell.x > 27) {
48
- this.setPosition(-32, this.y);
49
- }
50
- if (!this.gameMap[cell.y]?.[cell.x] ||
51
- this.gameMap[cell.y]?.[cell.x]?.type === 'teleporter') {
52
- // Do nothing else if on a teleporter
53
- return;
54
- }
55
- this.onCenter(cell);
56
- }
57
- }
58
- canMove(cell, direction) {
59
- const targetCell = { x: cell.x, y: cell.y };
60
- switch (direction) {
61
- case directions.LEFT:
62
- targetCell.x -= 1;
63
- break;
64
- case directions.RIGHT:
65
- targetCell.x += 1;
66
- break;
67
- case directions.UP:
68
- targetCell.y -= 1;
69
- break;
70
- case directions.DOWN:
71
- targetCell.y += 1;
72
- break;
73
- default:
74
- return false;
75
- }
76
- // Always allow teleporting through left/right edges
77
- if (targetCell.x < 0 || targetCell.x > 27) {
78
- return true;
79
- }
80
- const type = this.gameMap[targetCell.y]?.[targetCell.x]?.type;
81
- return type === 'empty' || type === 'teleporter';
82
- }
83
- changeDirection(direction) {
84
- this.direction = direction;
85
- switch (direction) {
86
- case directions.LEFT:
87
- this.setVelocity(-this.speed, 0);
88
- break;
89
- case directions.RIGHT:
90
- this.setVelocity(this.speed, 0);
91
- break;
92
- case directions.UP:
93
- this.setVelocity(0, -this.speed);
94
- break;
95
- case directions.DOWN:
96
- this.setVelocity(0, this.speed);
97
- break;
98
- }
99
- const tex = this.textureMap[direction];
100
- if (tex) {
101
- this.anims.stop();
102
- if (tex.startsWith('frame:')) {
103
- this.setFrame(tex.replace('frame:', ''));
104
- }
105
- else {
106
- this.anims.play(tex);
107
- }
108
- }
109
- }
110
- getOppositeDirection(direction) {
111
- switch (direction) {
112
- case directions.LEFT:
113
- return directions.RIGHT;
114
- case directions.RIGHT:
115
- return directions.LEFT;
116
- case directions.UP:
117
- return directions.DOWN;
118
- case directions.DOWN:
119
- return directions.UP;
120
- default:
121
- return -1;
122
- }
123
- }
124
- }
125
- //# sourceMappingURL=character.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"character.js","sourceRoot":"","sources":["../../../../src/game/sprites/characters/character.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,OAAgB,SAAU,SAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;IASlE,YACE,KAAmB,EACnB,OAAkB,EAClB,CAAS,EACT,CAAS,EACT,UAAkC,EAClC,OAAe,EACf,aAAsB;QAEtB,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;QAjB5C,aAAQ,GAAkC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QACxD,iBAAY,GAAkC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAC5D,cAAS,GAAW,CAAC,CAAC,CAAA;QAiBpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QACxB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,EAAE,IAAI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ClB,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;gBAC/B,MAAK;QACT,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;QACtC,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;YACjB,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAA;YAC1C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAES,oBAAoB,CAAC,SAAiB;QAC9C,QAAQ,SAAS,EAAE,CAAC;YAClB,KAAK,UAAU,CAAC,IAAI;gBAClB,OAAO,UAAU,CAAC,KAAK,CAAA;YACzB,KAAK,UAAU,CAAC,KAAK;gBACnB,OAAO,UAAU,CAAC,IAAI,CAAA;YACxB,KAAK,UAAU,CAAC,EAAE;gBAChB,OAAO,UAAU,CAAC,IAAI,CAAA;YACxB,KAAK,UAAU,CAAC,IAAI;gBAClB,OAAO,UAAU,CAAC,EAAE,CAAA;YACtB;gBACE,OAAO,CAAC,CAAC,CAAA;QACb,CAAC;IACH,CAAC;CAIF"}
@@ -1,11 +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 Blinky extends Ghost {
5
- protected readonly pelletCountToLeaveHouse = 0;
6
- protected readonly timerToLeaveHouse = 0;
7
- randomId: string;
8
- constructor(scene: Phaser.Scene, gameMap: PacManMap, pacman: Character, scatterTarget: Phaser.Types.Math.Vector2Like);
9
- onCenter(): void;
10
- }
11
- //# sourceMappingURL=blinky.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"blinky.d.ts","sourceRoot":"","sources":["../../../../src/game/sprites/ghosts/blinky.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,MAAO,SAAQ,KAAK;IAC/B,SAAS,CAAC,QAAQ,CAAC,uBAAuB,KAAI;IAC9C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,KAAI;IAExC,QAAQ,SAA8C;gBAGpD,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;CAIT"}