melonjs 18.2.1 → 18.2.2

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.
package/README.md ADDED
@@ -0,0 +1,255 @@
1
+ melonJS 2
2
+ =========
3
+ ![melonJS Logo](https://github.com/melonjs/melonJS/raw/master/media/Banner/Banner%20-%20Billboard%20-%20Original%20Logo%20-%20horizontal.png)
4
+
5
+ [![Build Status](https://github.com/melonjs/melonJS/actions/workflows/main.yml/badge.svg)](https://github.com/melonjs/melonJS/actions/workflows/main.yml)
6
+ [![NPM Package](https://img.shields.io/npm/v/melonjs)](https://www.npmjs.com/package/melonjs)
7
+ [![NPM Downloads](https://img.shields.io/npm/dm/melonjs)](https://www.npmjs.com/package/melonjs)
8
+ [![Build Size](https://badgen.net/bundlephobia/minzip/melonjs)](https://bundlephobia.com/result?p=melonjs)
9
+ [![Tree-shaking](https://badgen.net/bundlephobia/tree-shaking/melonjs)](https://bundlephobia.com/result?p=melonjs)
10
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/melonjs/badge?style=rounded)](https://www.jsdelivr.com/package/npm/melonjs)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE.md)
12
+ [![Discord](https://img.shields.io/discord/608636676461428758?color=7289da&label=discord)](https://discord.gg/aur7JMk)
13
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
14
+
15
+
16
+ A modern & lightweight HTML5 game engine
17
+ -------------------------------------------------------------------------------
18
+ ![melonJS](https://melonjs.org/img/alex4-github.png)
19
+
20
+ [melonJS](https://melonjs.org/) is an open-source HTML5 game engine that empowers developers to create 2D games using modern JavaScript and TypeScript. Built with ES6 classes and bundled using [esbuild](https://esbuild.github.io), it provides tree-shaking support for optimal bundle sizes.
21
+
22
+ [melonJS](https://melonjs.org/) is licensed under the [MIT License](LICENSE.md) and actively maintained with the help of a small team of enthusiasts at AltByte in Singapore.
23
+
24
+ Why melonJS
25
+ -------------------------------------------------------------------------------
26
+
27
+ melonJS is designed so you can **focus on making games, not on graphics plumbing**.
28
+
29
+ - **Canvas2D-inspired rendering API** — If you've used the HTML5 Canvas, you already know melonJS. The rendering API (`save`, `restore`, `translate`, `rotate`, `setColor`, `fillRect`, ...) follows the same familiar patterns — no render graphs, no shader pipelines, no instruction sets to learn.
30
+
31
+ - **True renderer abstraction** — Write your game once, run it on WebGL or Canvas2D with zero code changes. The engine handles all GPU complexity behind a unified API, with automatic fallback when WebGL is not available. Designed to support future backends (WebGPU) without touching game code.
32
+
33
+ - **Complete engine, minimal footprint** — Physics, tilemaps, audio, input, cameras, tweens, particles, UI — a full 2D game stack in a single tree-shakeable ES module. No dependency sprawl, no library stitching.
34
+
35
+ - **Tiled as a first-class citizen** — Deep [Tiled](https://www.mapeditor.org) integration built into the core: orthogonal, isometric, hexagonal and staggered maps, animated tilesets, collision shapes, object properties, compressed formats — all parsed and rendered natively.
36
+
37
+ - **Batteries included, hackable by design** — Get started in minutes with minimal setup. When you need to go deeper: ES6 classes throughout, a plugin system for engine extensions, and a clean architecture that's easy to extend without fighting the framework.
38
+
39
+ About melonJS
40
+ -------------------------------------------------------------------------------
41
+
42
+ [melonJS](https://melonjs.org/) is a fully featured game engine :
43
+
44
+ Compatibility
45
+ - Standalone library (does not rely on anything else, except a HTML5 capable browser)
46
+ - Compatible with all major browsers (Chrome, Safari, Firefox, Opera, Edge) and mobile devices
47
+
48
+ Graphics
49
+ - 2D sprite-based graphic engine
50
+ - Fast WebGL renderer for desktop and mobile devices with fallback to Canvas rendering
51
+ - Extensible batcher system for custom rendering pipelines
52
+ - High DPI resolution & Canvas advanced auto scaling
53
+ - Sprite with 9-slice scaling option, and animation management
54
+ - Built-in effects such as tinting, masking and 2D lighting
55
+ - Standard spritesheet, single and multiple Packed Textures support
56
+ - Compressed texture support (DDS, KTX, KTX2, PVR, PKM) with automatic format detection and fallback
57
+ - System & Bitmap Text
58
+ - Video sprite playback
59
+
60
+ Sound
61
+ - Web Audio support with 3D spatial audio and stereo panning based on [Howler](https://howlerjs.com)
62
+
63
+ Physics
64
+ - Polygon (SAT) based collision algorithm for accurate detection and response
65
+ - Fast Broad-phase collision detection using spatial partitioning (QuadTree)
66
+ - Collision filtering for optimized automatic collision detection
67
+ - Multiple shapes per body for complex hitboxes
68
+
69
+ Input
70
+ - Mouse and Touch device support (with mouse emulation)
71
+ - Gamepad support with button and axes binding
72
+ - Keyboard event handling with key binding system
73
+ - Device motion & accelerometer support
74
+
75
+ Camera
76
+ - Multi-camera support (split-screen, minimaps, multiple viewports)
77
+ - Camera follow with configurable deadzone and damping
78
+ - Built-in shake, fade and flash effects
79
+
80
+ UI
81
+ - Clickable, hoverable and draggable UI elements
82
+ - Drag-and-drop support
83
+ - Text buttons with built-in styling
84
+
85
+ Level Editor
86
+ - [Tiled](https://www.mapeditor.org) map format [up to 1.12](https://doc.mapeditor.org/en/stable/reference/tmx-changelog/) built-in support for easy level design
87
+ - Uncompressed and [compressed](https://github.com/melonjs/melonJS/tree/master/packages/tiled-inflate-plugin) Plain, Base64, CSV and JSON encoded XML tilemap loading
88
+ - Orthogonal, Isometric, Hexagonal (both normal and staggered) and Oblique maps
89
+ - Multiple layers (multiple background/foreground, collision and Image layers)
90
+ - Parallax scrolling via Image layers
91
+ - Animated and multiple Tileset support
92
+ - Tileset transparency settings
93
+ - Layers alpha and tinting settings
94
+ - Rectangle, Ellipse, Polygon and Polyline objects support
95
+ - Tiled Objects with custom properties
96
+ - Flipped & rotated Tiles
97
+ - Dynamic Layer and Object/Group ordering
98
+ - Dynamic Entity loading
99
+ - Shape based Tile collision support
100
+
101
+ Assets
102
+ - Asynchronous asset loading with progress tracking
103
+ - A fully customizable preloader
104
+ - Support for images, JSON, TMX/TSX, audio, video, binary and fonts
105
+
106
+ Core
107
+ - A state manager (to easily manage loading, menu, options, in-game state)
108
+ - Tween effects with multiple easing functions (Quadratic, Cubic, Elastic, Bounce, etc.) and Bezier/Catmull-Rom interpolation
109
+ - Transition effects
110
+ - Pooling support for object recycling
111
+ - Basic Particle System
112
+ - EventEmitter based event system
113
+ - Persistent data storage (save/load via localStorage)
114
+ - Plugin system for extending engine capabilities
115
+
116
+ Tools integration
117
+ -------------------------------------------------------------------------------
118
+ melonJS is supporting the below tools and frameworks natively or through our official plugin(s) :
119
+
120
+ [![Free Texture Packer](https://user-images.githubusercontent.com/4033090/136762061-1d3a0dfe-dbe0-4d3d-808d-47a49ecf5309.png "Free Texture Packer")](http://free-tex-packer.com)
121
+ [![TexturePacker](https://user-images.githubusercontent.com/4033090/136762472-bc55a638-c69b-4ff5-9d03-c684c8bea0ea.png "TexturePacker")](https://www.codeandweb.com/texturepacker)
122
+ [![PhysicsEditor](https://user-images.githubusercontent.com/4033090/136762890-b1010c7f-cb19-4d35-a3f1-f5048db07835.png "PhysicsEditor")](https://www.codeandweb.com/physicseditor)
123
+ [![ShoeBox](https://user-images.githubusercontent.com/4033090/136762705-92027d94-d87c-4a95-b051-26647410248d.png "ShoeBox")](https://renderhjs.net/shoebox/)
124
+ [![Tiled](https://user-images.githubusercontent.com/4033090/136762999-5a7f377b-4136-4205-9fe0-83728c90cb9b.png "Tiled")](https://www.mapeditor.org)
125
+ [![Cordova](https://user-images.githubusercontent.com/4033090/136763147-6d157ce6-6921-437e-bb8f-0287b86109da.png "Cordova")](https://cordova.apache.org)
126
+ [![Spine](https://github.com/melonjs/melonJS/assets/4033090/7a8d81b8-bc80-47bd-80dc-d9a054c78c96 "Spine")](http://esotericsoftware.com)
127
+ [![aseprite](https://github.com/melonjs/melonJS/assets/4033090/65d19fef-2eba-461a-b925-cc2ad3bb270c "aseprite")](https://www.aseprite.org)
128
+
129
+ Tools integration and usage with melonJS is documented in our [Wiki](https://github.com/melonjs/melonJS/wiki#third-party-tools-usage).
130
+
131
+ Getting Started
132
+ -------------------------------------------------------------------------------
133
+
134
+ The fastest way to create a new game:
135
+
136
+ npm create melonjs my-game
137
+ cd my-game
138
+ npm install
139
+ npm run dev
140
+
141
+ This scaffolds a ready-to-run project with TypeScript, Vite, and the debug plugin. It also works with plain JavaScript — just rename `.ts` files to `.js`.
142
+
143
+ You can also start from the [boilerplate](https://github.com/melonjs/typescript-boilerplate) directly, or follow the step-by-step [Platformer Tutorial](https://melonjs.org/tutorial/).
144
+
145
+ For more details, check the wiki [Details & Usage](https://github.com/melonjs/melonJS/wiki#details--usage) guide.
146
+
147
+ Examples
148
+ -------------------------------------------------------------------------------
149
+
150
+ * [Platformer](https://melonjs.github.io/melonJS/examples/#/platformer) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/platformer))
151
+ * [Isometric RPG](https://melonjs.github.io/melonJS/examples/#/isometric-rpg) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/isometricRpg))
152
+ * [SVG Shapes](https://melonjs.github.io/melonJS/examples/#/svg-shapes) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/svgShapes))
153
+ * [Graphics](https://melonjs.github.io/melonJS/examples/#/graphics) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/graphics))
154
+ * [Hello World](https://melonjs.github.io/melonJS/examples/#/hello-world) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/helloWorld))
155
+ * [Whac-A-Mole](https://melonjs.github.io/melonJS/examples/#/whac-a-mole) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/whac-a-mole))
156
+ * [Compressed Textures](https://melonjs.github.io/melonJS/examples/#/compressed-textures) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/compressedTextures))
157
+ * [Spine](https://melonjs.github.io/melonJS/examples/#/spine) ([source](https://github.com/melonjs/melonJS/tree/master/packages/examples/src/examples/spine))
158
+
159
+ Browse all examples [here](https://melonjs.github.io/melonJS/examples/)
160
+
161
+ -------------------------------------------------------------------------------
162
+
163
+ ### Basic Hello World Example
164
+
165
+ ```JavaScript
166
+ import * as me from "https://cdn.jsdelivr.net/npm/melonjs/+esm";
167
+
168
+ me.device.onReady(function () {
169
+ // initialize the display canvas once the device/browser is ready
170
+ if (!me.video.init(1218, 562, {parent : "screen", scale : "auto"})) {
171
+ alert("Your browser does not support HTML5 canvas.");
172
+ return;
173
+ }
174
+
175
+ // set a gray background color
176
+ me.game.world.backgroundColor.parseCSS("#202020");
177
+
178
+ // add a font text display object
179
+ me.game.world.addChild(new me.Text(609, 281, {
180
+ font: "Arial",
181
+ size: 160,
182
+ fillStyle: "#FFFFFF",
183
+ textBaseline : "middle",
184
+ textAlign : "center",
185
+ text : "Hello World !"
186
+ }));
187
+ });
188
+ ```
189
+ > Simple hello world using melonJS 2
190
+
191
+ Documentation
192
+ -------------------------------------------------------------------------------
193
+
194
+ * [Online API](https://melonjs.github.io/melonJS/)
195
+
196
+ Plugins
197
+ -------------------------------------------------------------------------------
198
+ melonJS provides a plugin system allowing to extend the engine capabilities.
199
+
200
+ Here is the list of official plugins maintained by the melonJS team:
201
+ - [debug-plugin](https://github.com/melonjs/melonJS/tree/master/packages/debug-plugin) - a debug panel for inspecting game objects
202
+ - [tiled-inflate-plugin](https://github.com/melonjs/melonJS/tree/master/packages/tiled-inflate-plugin) - enable loading and parsing of zlib, gzip and zstd compressed [Tiled](https://www.mapeditor.org/) maps
203
+ - [spine-plugin](https://github.com/melonjs/melonJS/tree/master/packages/spine-plugin) - [Spine](http://esotericsoftware.com) runtime integration to render Spine skeletal animations
204
+
205
+ If you wish to develop your own plugin, we also provide a [plugin template](https://github.com/melonjs/plugin-template) to help you get started.
206
+
207
+ Installation
208
+ -------------------------------------------------------------------------------
209
+
210
+ melonJS is distributed as a tree-shakeable ES6 module with TypeScript declarations included.
211
+
212
+ Install via [npm](https://www.npmjs.com/package/melonjs) :
213
+
214
+ npm install melonjs
215
+
216
+ Then import it in your project :
217
+
218
+ ```JavaScript
219
+ import * as me from 'melonjs';
220
+ ```
221
+
222
+ Or use it directly via [jsDelivr](https://www.jsdelivr.com/package/npm/melonjs) CDN :
223
+
224
+ ```html
225
+ <!-- load the ES6 module bundle of melonJS v18.x -->
226
+ <script type="module" src="https://cdn.jsdelivr.net/npm/melonjs@18/+esm"></script>
227
+ <!-- omit the version completely to get the latest one -->
228
+ <!-- you should NOT use this in production -->
229
+ <script type="module" src="https://cdn.jsdelivr.net/npm/melonjs/+esm"></script>
230
+ ```
231
+ > Note: the debug plugin is available separately as [`@melonjs/debug-plugin`](https://www.npmjs.com/package/@melonjs/debug-plugin)
232
+
233
+ Community
234
+ -------------------------------------------------------------------------------
235
+ Join us and get help or share your projects :
236
+
237
+ - [Discord](https://discord.gg/aur7JMk)
238
+ - [Wiki](https://github.com/melonjs/melonJS/wiki)
239
+ - [FAQ](https://github.com/melonjs/melonJS/wiki/FAQ)
240
+
241
+ Contributing
242
+ -------------------------------------------------------------------------------
243
+ We welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) before submitting changes or new features.
244
+
245
+ <a href = "https://github.com/melonjs/melonJS/graphs/contributors">
246
+ <img src = "https://contrib.rocks/image?repo=melonJS/melonjs"/>
247
+ </a>
248
+
249
+ Sponsors
250
+ -------------------------------------------------------------------------------
251
+ Support the development of melonJS by [becoming a sponsor](https://github.com/sponsors/melonjs). Get your logo in our README with a link to your site or become a backer and get your name in the [BACKERS](BACKERS.md) list. Any level of support is really appreciated and goes a long way !
252
+
253
+ [![Melon Gaming](https://user-images.githubusercontent.com/4033090/136695857-d098c27d-f4b2-4c71-8574-b5f4291779cb.png "Melon Gaming")](https://www.melongaming.com)
254
+
255
+ [![Altbyte Pte Ltd](https://user-images.githubusercontent.com/4033090/136692693-35dca8aa-5012-4a37-9ea2-51640d2e6d73.png "AltByte")](https://www.altbyte.com)
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * melonJS Game Engine - 18.2.1
2
+ * melonJS Game Engine - 18.2.2
3
3
  * http://www.melonjs.org
4
4
  * melonjs is licensed under the MIT License.
5
5
  * http://www.opensource.org/licenses/mit-license
@@ -28200,7 +28200,7 @@ __export(plugin_exports, {
28200
28200
  });
28201
28201
 
28202
28202
  // src/version.ts
28203
- var version = "18.2.1";
28203
+ var version = "18.2.2";
28204
28204
 
28205
28205
  // src/plugin/plugin.ts
28206
28206
  var cache = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "18.2.1",
3
+ "version": "18.2.2",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "type": "module",
@@ -79,12 +79,12 @@
79
79
  "build:watch": "tsx scripts/build.js watch",
80
80
  "lint": "eslint src tests",
81
81
  "build": "pnpm lint && tsx scripts/build.js && pnpm types",
82
- "dist": "pnpm clean && pnpm lint && pnpm vitest run && pnpm build && pnpm doc",
82
+ "dist": "pnpm clean && pnpm lint && pnpm vitest run && pnpm build && pnpm doc && cp ../../README.md .",
83
83
  "doc": "typedoc src/index.js --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false",
84
84
  "doc:watch": "typedoc src/index.js --tsconfig tsconfig.build.json --readme DOC_README.md --hideGenerator --name 'melonJS' --navigation.includeCategories true --categorizeByGroup false --watch --skipErrorChecking --preserveWatchOutput --logLevel Error",
85
85
  "serve": "serve docs",
86
86
  "prepublishOnly": "pnpm dist",
87
- "clean": "tsx scripts/clean.js",
87
+ "clean": "tsx scripts/clean.ts",
88
88
  "types": "tsc --project tsconfig.build.json",
89
89
  "test:types": "tsc"
90
90
  }