mustachio-game 1.0.0

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 (101) hide show
  1. package/.github/workflows/pr.yaml +21 -0
  2. package/.github/workflows/push.yaml +26 -0
  3. package/eslint.config.ts +17 -0
  4. package/index.html +22 -0
  5. package/package.json +35 -0
  6. package/src/assets/Mustachio.webp +0 -0
  7. package/src/assets/Mustachio_FacingLeft.webp +0 -0
  8. package/src/assets/Mustachio_FacingLeft_Fire.webp +0 -0
  9. package/src/assets/Mustachio_FacingRight.webp +0 -0
  10. package/src/assets/Mustachio_FacingRight_Fire.webp +0 -0
  11. package/src/assets/Mustachio_Fire.webp +0 -0
  12. package/src/assets/brick.webp +0 -0
  13. package/src/assets/cannonDown.webp +0 -0
  14. package/src/assets/cannonLeft.webp +0 -0
  15. package/src/assets/cannonRight.webp +0 -0
  16. package/src/assets/cannonUp.webp +0 -0
  17. package/src/assets/fallingFloor.webp +0 -0
  18. package/src/assets/homestead.webp +0 -0
  19. package/src/assets/homesteadClosed.webp +0 -0
  20. package/src/assets/itemBlock.webp +0 -0
  21. package/src/assets/obstacleBrick.webp +0 -0
  22. package/src/assets/punchedBlock.webp +0 -0
  23. package/src/assets/stacheSeed1.webp +0 -0
  24. package/src/assets/stacheSeed2.webp +0 -0
  25. package/src/assets/stacheSeedReversed1.webp +0 -0
  26. package/src/assets/stacheSeedReversed2.webp +0 -0
  27. package/src/assets/stacheShotDown.webp +0 -0
  28. package/src/assets/stacheShotLeft.webp +0 -0
  29. package/src/assets/stacheShotRight.webp +0 -0
  30. package/src/assets/stacheShotUp.webp +0 -0
  31. package/src/assets/stacheSlinger1.webp +0 -0
  32. package/src/assets/stacheSlinger2.webp +0 -0
  33. package/src/assets/stacheStalker.webp +0 -0
  34. package/src/assets/stacheStalkerReversed.webp +0 -0
  35. package/src/assets/stacheStreaker1.webp +0 -0
  36. package/src/assets/stacheStreaker2.webp +0 -0
  37. package/src/classes/game-objects/bg-objects/background.ts +18 -0
  38. package/src/classes/game-objects/bg-objects/cloud.ts +37 -0
  39. package/src/classes/game-objects/mustachio.ts +482 -0
  40. package/src/classes/game-objects/point-objects/enemies/enemy.ts +64 -0
  41. package/src/classes/game-objects/point-objects/enemies/stache-seed.ts +124 -0
  42. package/src/classes/game-objects/point-objects/enemies/stache-shot.ts +68 -0
  43. package/src/classes/game-objects/point-objects/enemies/stache-slinger.ts +63 -0
  44. package/src/classes/game-objects/point-objects/enemies/stache-stalker.ts +41 -0
  45. package/src/classes/game-objects/point-objects/enemies/stache-streaker.ts +78 -0
  46. package/src/classes/game-objects/point-objects/items/coin.ts +72 -0
  47. package/src/classes/game-objects/point-objects/items/fire-stache.ts +48 -0
  48. package/src/classes/game-objects/point-objects/items/item.ts +27 -0
  49. package/src/classes/game-objects/point-objects/items/stacheroom.ts +48 -0
  50. package/src/classes/game-objects/point-objects/point-item.ts +10 -0
  51. package/src/classes/game-objects/projectiles/brick-debris.ts +44 -0
  52. package/src/classes/game-objects/projectiles/enemy-projectiles/enemy-projectile.ts +3 -0
  53. package/src/classes/game-objects/projectiles/enemy-projectiles/fire-ball.ts +87 -0
  54. package/src/classes/game-objects/projectiles/enemy-projectiles/fire-bar.ts +65 -0
  55. package/src/classes/game-objects/projectiles/enemy-projectiles/fire-cross.ts +67 -0
  56. package/src/classes/game-objects/projectiles/enemy-projectiles/laser.ts +41 -0
  57. package/src/classes/game-objects/projectiles/projectile.ts +3 -0
  58. package/src/classes/game-objects/projectiles/stache-ball.ts +57 -0
  59. package/src/classes/game-objects/set-pieces/flag.ts +34 -0
  60. package/src/classes/game-objects/set-pieces/obstacles/blocks/block.ts +17 -0
  61. package/src/classes/game-objects/set-pieces/obstacles/blocks/cave-wall.ts +21 -0
  62. package/src/classes/game-objects/set-pieces/obstacles/blocks/falling-floor.ts +65 -0
  63. package/src/classes/game-objects/set-pieces/obstacles/blocks/fire-bar-block.ts +31 -0
  64. package/src/classes/game-objects/set-pieces/obstacles/blocks/fire-cross-block.ts +28 -0
  65. package/src/classes/game-objects/set-pieces/obstacles/blocks/punchable-blockS/brick.ts +44 -0
  66. package/src/classes/game-objects/set-pieces/obstacles/blocks/punchable-blockS/item-block.ts +82 -0
  67. package/src/classes/game-objects/set-pieces/obstacles/blocks/punchable-blockS/punchable-block.ts +6 -0
  68. package/src/classes/game-objects/set-pieces/obstacles/blocks/stache-cannon.ts +54 -0
  69. package/src/classes/game-objects/set-pieces/obstacles/blocks/wall.ts +22 -0
  70. package/src/classes/game-objects/set-pieces/obstacles/floor.ts +27 -0
  71. package/src/classes/game-objects/set-pieces/obstacles/obstacle-types.ts +14 -0
  72. package/src/classes/game-objects/set-pieces/obstacles/obstacle.ts +3 -0
  73. package/src/classes/game-objects/set-pieces/obstacles/pipe.ts +35 -0
  74. package/src/classes/game-objects/set-pieces/obstacles/warp-pipe.ts +17 -0
  75. package/src/classes/game-objects/set-pieces/set-piece.ts +3 -0
  76. package/src/classes/game-objects/ui-objects/score-display.ts +10 -0
  77. package/src/classes/game-objects/ui-objects/timer-display.ts +15 -0
  78. package/src/classes/game-objects/ui-objects/ui-object.ts +16 -0
  79. package/src/classes/game-objects/ui-objects/win-display.ts +25 -0
  80. package/src/dev.ts +5 -0
  81. package/src/index.ts +3 -0
  82. package/src/levels/caves/cave-one.ts +90 -0
  83. package/src/levels/level-helpers.ts +101 -0
  84. package/src/levels/level-one.ts +379 -0
  85. package/src/levels/test-levels/blocks-and-items.ts +77 -0
  86. package/src/levels/test-levels/cannon-and-cross.ts +75 -0
  87. package/src/levels/test-levels/caves-and-enemies.ts +73 -0
  88. package/src/levels/test-levels/win-game.ts +24 -0
  89. package/src/main.ts +6 -0
  90. package/src/mustachi-game-context.ts +35 -0
  91. package/src/shared/app-code.ts +106 -0
  92. package/src/shared/constants.ts +1 -0
  93. package/src/shared/game-context.ts +547 -0
  94. package/src/shared/game-objects/game-object.ts +28 -0
  95. package/src/shared/game-objects/moving-game-object.ts +46 -0
  96. package/src/shared/game-objects/rotating-game-object.ts +58 -0
  97. package/src/shared/game-objects/updating-game-object.ts +7 -0
  98. package/src/shared/player.ts +73 -0
  99. package/src/shared/types.ts +21 -0
  100. package/tsconfig.json +26 -0
  101. package/vite.config.ts +13 -0
@@ -0,0 +1,21 @@
1
+ name: 'Verify Typescript'
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ Build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-node@v4
14
+ with:
15
+ cache: "npm"
16
+
17
+ - name: Build and Lint
18
+ run: |
19
+ npm ci
20
+ npm run lint
21
+ npm run build
@@ -0,0 +1,26 @@
1
+ name: Tag and Release on Main
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+
10
+ publish-package:
11
+ uses: 'parkerstovall/workflows/.github/workflows/Publish_NPM.yaml@main'
12
+ with:
13
+ package_directory: '.'
14
+ secrets:
15
+ npm_token: ${{ secrets.NPM_AUTH_TOKEN }}
16
+
17
+ update-pac-man-repo:
18
+ if: ${{ needs.publish-package.outputs.created_tag == 'true' }}
19
+ uses: 'parkerstovall/workflows/.github/workflows/Push_PackageUpdate.yaml@main'
20
+ needs: publish-package
21
+ with:
22
+ package_directory: '.'
23
+ repo: 'parkerstovall/mustachio'
24
+ package_name: 'mustachio'
25
+ secrets:
26
+ repo_token: ${{ secrets.CROSS_REPO_TOKEN }}
@@ -0,0 +1,17 @@
1
+ import js from "@eslint/js";
2
+ import globals from "globals";
3
+ import tseslint from "typescript-eslint";
4
+ import { defineConfig, globalIgnores } from "eslint/config";
5
+ import pluginPrettier from "eslint-plugin-prettier/recommended";
6
+
7
+ export default defineConfig([
8
+ globalIgnores(["dist/", "**/*.js"]),
9
+ {
10
+ files: ["**/*.ts"],
11
+ plugins: { js, tseslint },
12
+ extends: ["js/recommended"],
13
+ languageOptions: { globals: globals.browser },
14
+ },
15
+ tseslint.configs.recommended,
16
+ pluginPrettier,
17
+ ]);
package/index.html ADDED
@@ -0,0 +1,22 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>mustachio</title>
8
+ </head>
9
+ <body>
10
+ <style>
11
+ #app {
12
+ height: 36vw;
13
+ width: 64vw;
14
+ margin: auto;
15
+ }
16
+ </style>
17
+
18
+ <div id="app"></div>
19
+ <script type="module" src="/src/dev.ts"></script>
20
+ </script>
21
+ </body>
22
+ </html>
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "mustachio-game",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "scripts": {
13
+ "dev": "vite",
14
+ "lint": "eslint . --fix",
15
+ "build": "tsc && vite build",
16
+ "preview": "vite preview"
17
+ },
18
+ "devDependencies": {
19
+ "@eslint/js": "^9.39.2",
20
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
21
+ "@typescript-eslint/parser": "^8.54.0",
22
+ "eslint": "^9.39.2",
23
+ "eslint-config-prettier": "^10.1.8",
24
+ "eslint-plugin-prettier": "^5.5.5",
25
+ "globals": "^17.2.0",
26
+ "jiti": "^2.6.1",
27
+ "prettier": "^3.8.1",
28
+ "typescript": "~5.9.3",
29
+ "typescript-eslint": "^8.54.0",
30
+ "vite": "npm:rolldown-vite@7.2.5"
31
+ },
32
+ "overrides": {
33
+ "vite": "npm:rolldown-vite@7.2.5"
34
+ }
35
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,18 @@
1
+ import type { GameContext } from "../../../shared/game-context";
2
+ import { GameObject } from "../../../shared/game-objects/game-object";
3
+
4
+ export class Background extends GameObject {
5
+ constructor(gameContext: GameContext) {
6
+ super(gameContext, {
7
+ width: gameContext.gameArea.width,
8
+ height: gameContext.gameArea.height,
9
+ x: 0,
10
+ y: 0,
11
+ });
12
+ }
13
+
14
+ draw(ctx: CanvasRenderingContext2D): void {
15
+ ctx.fillStyle = "#87CEEB"; // Sky blue color
16
+ ctx.fillRect(0, 0, this.rect.width, this.rect.height);
17
+ }
18
+ }
@@ -0,0 +1,37 @@
1
+ import type { GameContext } from "../../../shared/game-context";
2
+ import { UpdatingGameObject } from "../../../shared/game-objects/updating-game-object";
3
+ import type { collision } from "../../../shared/types";
4
+
5
+ export class Cloud extends UpdatingGameObject {
6
+ private readonly speed = 0.3;
7
+ constructor(gameContext: GameContext, x: number, y: number) {
8
+ super(gameContext, {
9
+ width: 100,
10
+ height: 60,
11
+ x: x,
12
+ y: y,
13
+ });
14
+ }
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ update(_: collision[]): void {
18
+ this.rect.x -= this.speed;
19
+
20
+ // Reset position if the cloud goes off-screen
21
+ if (this.rect.x + this.rect.width < 0) {
22
+ this.rect.x = this.gameContext.gameArea.width;
23
+ }
24
+ }
25
+
26
+ draw(ctx: CanvasRenderingContext2D): void {
27
+ ctx.fillStyle = "#FFFFFF"; // White color for the cloud
28
+ ctx.beginPath();
29
+
30
+ // Draw a simple cloud shape
31
+ ctx.arc(this.rect.x, this.rect.y - 20, 25, 0, 360);
32
+ ctx.arc(this.rect.x + 20, this.rect.y, 25, 0, 360);
33
+ ctx.arc(this.rect.x - 20, this.rect.y, 25, 0, 360);
34
+ ctx.closePath();
35
+ ctx.fill();
36
+ }
37
+ }