melonjs 9.1.0 → 10.0.1
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/{LICENSE → LICENSE.md} +0 -0
- package/README.md +93 -57
- package/dist/melonjs.js +10334 -11179
- package/dist/melonjs.min.js +4 -10
- package/dist/melonjs.module.d.ts +13206 -0
- package/dist/melonjs.module.js +9913 -10872
- package/package.json +19 -14
- package/src/audio/audio.js +477 -553
- package/src/camera/camera2d.js +67 -65
- package/src/entity/draggable.js +26 -35
- package/src/entity/droptarget.js +17 -14
- package/src/entity/entity.js +59 -79
- package/src/game.js +194 -204
- package/src/index.js +12 -30
- package/src/input/gamepad.js +8 -19
- package/src/input/keyboard.js +4 -4
- package/src/input/pointer.js +14 -12
- package/src/input/pointerevent.js +15 -13
- package/src/lang/deprecated.js +2 -887
- package/src/level/level.js +3 -3
- package/src/level/tiled/TMXGroup.js +7 -11
- package/src/level/tiled/TMXLayer.js +33 -32
- package/src/level/tiled/TMXTileMap.js +15 -19
- package/src/level/tiled/TMXTileset.js +5 -5
- package/src/level/tiled/TMXUtils.js +3 -3
- package/src/level/tiled/renderer/TMXRenderer.js +4 -0
- package/src/loader/loader.js +8 -23
- package/src/loader/loadingscreen.js +51 -60
- package/src/math/matrix3.js +1 -1
- package/src/particles/emitter.js +36 -39
- package/src/particles/particle.js +27 -12
- package/src/particles/particlecontainer.js +17 -16
- package/src/physics/body.js +80 -118
- package/src/physics/collision.js +5 -235
- package/src/physics/detector.js +235 -0
- package/src/physics/quadtree.js +14 -14
- package/src/physics/world.js +84 -18
- package/src/plugin/plugin.js +26 -24
- package/src/polyfill/console.js +9 -14
- package/src/renderable/GUI.js +48 -62
- package/src/renderable/collectable.js +11 -4
- package/src/renderable/colorlayer.js +28 -26
- package/src/renderable/container.js +120 -96
- package/src/renderable/imagelayer.js +94 -93
- package/src/renderable/renderable.js +164 -138
- package/src/renderable/sprite.js +42 -44
- package/src/renderable/trigger.js +24 -17
- package/src/shapes/ellipse.js +27 -27
- package/src/shapes/line.js +12 -8
- package/src/shapes/poly.js +77 -49
- package/src/shapes/rectangle.js +193 -268
- package/src/state/stage.js +23 -25
- package/src/state/state.js +35 -86
- package/src/system/device.js +233 -285
- package/src/system/event.js +485 -432
- package/src/system/pooling.js +61 -54
- package/src/system/save.js +17 -16
- package/src/system/timer.js +34 -38
- package/src/text/bitmaptext.js +44 -46
- package/src/text/text.js +39 -34
- package/src/tweens/easing.js +0 -2
- package/src/tweens/interpolation.js +3 -8
- package/src/tweens/tween.js +332 -351
- package/src/utils/function.js +6 -8
- package/src/utils/utils.js +34 -30
- package/src/video/canvas/canvas_renderer.js +13 -8
- package/src/video/renderer.js +8 -7
- package/src/video/texture.js +8 -8
- package/src/video/texture_cache.js +5 -5
- package/src/video/video.js +373 -403
- package/src/video/webgl/glshader.js +2 -2
- package/src/video/webgl/webgl_compositor.js +14 -8
- package/src/video/webgl/webgl_renderer.js +21 -19
- package/plugins/debug/debugPanel.js +0 -770
- package/plugins/debug/font/PressStart2P.fnt +0 -100
- package/plugins/debug/font/PressStart2P.ltr +0 -1
- package/plugins/debug/font/PressStart2P.png +0 -0
- package/plugins/debug/particleDebugPanel.js +0 -303
package/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,46 +1,55 @@
|
|
|
1
|
-
melonJS
|
|
2
|
-
|
|
1
|
+
melonJS 2
|
|
2
|
+
=========
|
|
3
3
|
[](https://travis-ci.org/melonjs/melonJS)
|
|
4
4
|
[](https://lgtm.com/projects/g/melonjs/melonJS/context:javascript)
|
|
5
5
|
[](https://bundlephobia.com/result?p=melonjs)
|
|
6
6
|
[](https://david-dm.org/melonjs/melonJS)
|
|
7
|
-
[](https://www.npmjs.com/package/melonjs)
|
|
8
8
|
[](https://www.boss.dev/issues/repo/melonjs/melonJS)
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
A fresh & lightweight HTML5 game engine
|
|
11
|
+
A fresh, _modern_ & lightweight HTML5 game engine
|
|
12
12
|
-------------------------------------------------------------------------------
|
|
13
13
|

|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
melonJS 2 is a modern version of the melonJS game engine. It has been rebuilt almost entirely using ES6 class, inheritance and semantic, and is bundled using Rollup to provide modern features such as transpiling and tree-shaking.
|
|
16
16
|
|
|
17
|
-
[melonJS](
|
|
17
|
+
>Note: migrating an existing project to melonJS 2 (version 10.0 and higher) will definitely break your game (ES6 semantic, no more Jay inheritance, nodeJS event emitter, and no backward compatibility with deprecated legacy APIs), and you might want to read first this small step by step guide on [upgrading to melonJS 2](https://github.com/melonjs/melonJS/wiki/Upgrading-to-melonJS-2). If you are looking at the legacy version (9.x and lower) of melonJS, you can find it [here](https://github.com/melonjs/melonJS/tree/legacy) under the _legacy_ branch.
|
|
18
|
+
|
|
19
|
+
[melonJS](http://melonjs.org/) is open-source, licensed under the [MIT License](LICENSE.md), and actively developed and maintained with the help of a small team of enthusiasts at AltByte in Singapore.
|
|
18
20
|
|
|
19
21
|
About melonJS
|
|
20
22
|
-------------------------------------------------------------------------------
|
|
21
23
|
|
|
22
|
-
[melonJS](http://melonjs.org/) is
|
|
23
|
-
and currently features :
|
|
24
|
+
[melonJS](http://melonjs.org/) is a fully featured game engine :
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
Compatibility
|
|
26
27
|
- Standalone library (does not rely on anything else, except a HTML5 capable browser)
|
|
27
28
|
- Compatible with all major browsers (Chrome, Safari, Firefox, Opera, Edge) and mobile devices
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
Graphics
|
|
31
|
+
- 2D sprite-based graphic engine
|
|
32
|
+
- Fast WebGL 1 & 2 renderer for desktop and mobile devices with fallback to Canvas rendering
|
|
29
33
|
- High DPI resolution & Canvas advanced auto scaling
|
|
30
|
-
- Web Audio support with fallback to Multi-channel HTML5 audio
|
|
31
|
-
- Lightweight physics implementation to ensure low cpu requirements
|
|
32
|
-
- Polygon (SAT) based collision algorithm for accurate detection and response
|
|
33
|
-
- Fast Broad-phase collision detection using spatial partitioning
|
|
34
|
-
- 3rd party tools support for physic body definition such as [PhysicsEditor](https://www.codeandweb.com/physicseditor)
|
|
35
|
-
- Advanced math API for Vector and Matrix
|
|
36
|
-
- Tween Effects, Transition effects
|
|
37
|
-
- Basic set of Object Entities and GUI elements included
|
|
38
|
-
- Pooling support for object recycling
|
|
39
|
-
- Basic Particle System
|
|
40
34
|
- Sprite with Animation management
|
|
35
|
+
- built-in effects such as tinting and masking
|
|
41
36
|
- Standard spritesheet, single and multiple Packed Textures support
|
|
42
|
-
-
|
|
43
|
-
|
|
37
|
+
- System & Bitmap Text
|
|
38
|
+
|
|
39
|
+
Sound
|
|
40
|
+
- Web Audio support with spatial audio or stereo panning based on [Howler](https://howlerjs.com)
|
|
41
|
+
- fallback to Multi-channel HTML5 audio for legacy browsers
|
|
42
|
+
|
|
43
|
+
Physic
|
|
44
|
+
- Polygon (SAT) based collision algorithm for accurate detection and response
|
|
45
|
+
- Fast Broad-phase collision detection using spatial partitioning
|
|
46
|
+
- Collision filtering for optimized automatic collision detection
|
|
47
|
+
|
|
48
|
+
Input
|
|
49
|
+
- Mouse and Touch device support (with mouse emulation)
|
|
50
|
+
- Device motion & accelerometer support
|
|
51
|
+
|
|
52
|
+
Level Editor
|
|
44
53
|
- Tiled map format version +1.0 integration for easy level design
|
|
45
54
|
- Uncompressed Plain, Base64, CSV and JSON encoded XML tilemap loading
|
|
46
55
|
- Orthogonal, Isometric and Hexagonal maps (both normal and staggered)
|
|
@@ -54,13 +63,29 @@ and currently features :
|
|
|
54
63
|
- Dynamic Layer and Object/Group ordering
|
|
55
64
|
- Dynamic Entity loading
|
|
56
65
|
- Shape based Tile collision support
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
- Built-in support for 3rd party Application Wrappers such as [Cordova](https://cordova.apache.org)
|
|
61
|
-
- Asynchronous publish/subscribe pattern messaging support (minPubSub)
|
|
66
|
+
|
|
67
|
+
Assets
|
|
68
|
+
- Asynchronous asset loading
|
|
62
69
|
- A fully customizable preloader
|
|
63
|
-
|
|
70
|
+
|
|
71
|
+
And Also
|
|
72
|
+
- A state manager (to easily manage loading, menu, options, in-game state)
|
|
73
|
+
- Tween Effects, Transition effects
|
|
74
|
+
- Pooling support for object recycling
|
|
75
|
+
- Basic Particle System
|
|
76
|
+
- nodeJS EventEmitter based event system
|
|
77
|
+
|
|
78
|
+
Tools integration
|
|
79
|
+
-------------------------------------------------------------------------------
|
|
80
|
+
[](http://free-tex-packer.com)
|
|
81
|
+
[](https://www.codeandweb.com/texturepacker)
|
|
82
|
+
[](https://www.codeandweb.com/physicseditor)
|
|
83
|
+
[](https://renderhjs.net/shoebox/)
|
|
84
|
+
[](https://www.mapeditor.org)
|
|
85
|
+
[](https://cordova.apache.org)
|
|
86
|
+
|
|
87
|
+
Tools integration and usage with melonJS is documented in our [Wiki](https://github.com/melonjs/melonJS/wiki#third-party-tools-usage).
|
|
88
|
+
|
|
64
89
|
|
|
65
90
|
Using melonJS
|
|
66
91
|
-------------------------------------------------------------------------------
|
|
@@ -68,7 +93,7 @@ Using melonJS
|
|
|
68
93
|
Basic Example
|
|
69
94
|
|
|
70
95
|
```JavaScript
|
|
71
|
-
import * as me from "melonjs.module.js"
|
|
96
|
+
import * as me from "melonjs.module.js";
|
|
72
97
|
|
|
73
98
|
me.device.onReady(function () {
|
|
74
99
|
// initialize the display canvas once the device/browser is ready
|
|
@@ -96,65 +121,68 @@ me.device.onReady(function () {
|
|
|
96
121
|
Documentation :
|
|
97
122
|
|
|
98
123
|
* [Online API](http://melonjs.github.io/melonJS/docs/) ([offline](https://github.com/melonjs/melonJS/archive/gh-pages.zip) version under the `docs` directory)
|
|
99
|
-
* [Examples](https://melonjs.github.io/examples/)
|
|
100
124
|
|
|
101
125
|
For your first time using melonJS, follow these tutorials :
|
|
102
126
|
|
|
103
127
|
- [Platformer](http://melonjs.github.io/tutorial-platformer/) Step by Step Tutorial.
|
|
104
128
|
- [Space Invaders](http://melonjs.github.io/tutorial-space-invaders/) Step by Step Tutorial.
|
|
105
129
|
|
|
130
|
+
> Note: current version of both the tutorials are not compatible with the ES6 version.
|
|
131
|
+
|
|
106
132
|
You may find it useful to skim the overview found at the wiki [Details & Usage](https://github.com/melonjs/melonJS/wiki#details--usage)
|
|
107
133
|
|
|
108
|
-
When starting your own projects, checkout
|
|
134
|
+
When starting your own projects, checkout our [es6 boilerplate](https://github.com/melonjs/es6-boilerplate)
|
|
135
|
+
|
|
136
|
+
Demos
|
|
137
|
+
-------------------------------------------------------------------------------
|
|
138
|
+
|
|
139
|
+
A few demos of melonJS capabilities :
|
|
140
|
+
|
|
141
|
+
* [Platformer Demo](https://melonjs.github.io/examples/examples/platformer/)
|
|
142
|
+
* [Isometric Demo](https://melonjs.github.io/examples/examples/isometric_rpg/)
|
|
143
|
+
* [Sprite Demo](https://melonjs.github.io/examples/examples/sprite/)
|
|
144
|
+
* [Masking Demo](https://melonjs.github.io/examples/examples/masking/)
|
|
145
|
+
* [Primitive Drawing Demo](https://melonjs.github.io/examples/examples/graphics/)
|
|
146
|
+
* [UI Demo](https://melonjs.github.io/examples/examples/UI/)
|
|
147
|
+
|
|
148
|
+
More examples are available [here](https://melonjs.github.io/examples/)
|
|
109
149
|
|
|
110
150
|
Download melonJS
|
|
111
151
|
-------------------------------------------------------------------------------
|
|
112
152
|
|
|
113
153
|
The latest builds with corresponding release note are available for direct download [here](https://github.com/melonjs/melonJS/releases).
|
|
114
154
|
|
|
115
|
-
Since version
|
|
155
|
+
Since version 10.0.0 melonJS provides different build options :
|
|
116
156
|
|
|
117
157
|
| build | description |
|
|
118
158
|
| ------------------- | ----------- |
|
|
119
|
-
| `melonjs.js`
|
|
120
|
-
| `melonjs.
|
|
121
|
-
| `melonjs.
|
|
122
|
-
|
|
123
|
-
> Note: current version of both the tutorials and the debugPanel are not compatible with the ES6 version.
|
|
159
|
+
| `melonjs.module.js` | the ES6 Module (ESM) Bundle |
|
|
160
|
+
| `melonjs.module.d.ts` | typescript declaration file for the ES6 Module (ESM) Bundle |
|
|
161
|
+
| `melonjs.js` | a ES5 UMD Bundle (directly transpiled from the ES6 version) |
|
|
162
|
+
| `melonjs.min.js` | a minified version of the ES5 UMD bundle |
|
|
124
163
|
|
|
125
164
|
Alternatively, the latest version of melonJS can be installed through [NPM](https://www.npmjs.com/package/melonjs) :
|
|
126
165
|
|
|
127
166
|
$ npm install melonjs
|
|
128
167
|
|
|
129
|
-
If you need to import the ES6 module of melonjs :
|
|
130
|
-
|
|
131
|
-
$ import * as me from "melonjs.module.js";
|
|
168
|
+
If you need to import the ES6 module of melonjs (e.g. for Webpack):
|
|
132
169
|
|
|
133
|
-
|
|
170
|
+
$ import * as me from 'melonjs/dist/melonjs.module.js';
|
|
134
171
|
|
|
135
172
|
Or can simply be added to your html, through a content delivery network (CDN) URL, using for example :
|
|
136
173
|
|
|
137
174
|
```html
|
|
138
|
-
<!-- load the ES5 UMD bundle of melonJS
|
|
139
|
-
<script src="https://cdn.jsdelivr.net/npm/melonjs@
|
|
140
|
-
<!-- load the ES6 module bundle of melonJS
|
|
141
|
-
<script src="https://cdn.jsdelivr.net/npm/melonjs@
|
|
175
|
+
<!-- load the ES5 UMD bundle of melonJS v10.0.0 -->
|
|
176
|
+
<script src="https://cdn.jsdelivr.net/npm/melonjs@10.0.0/dist/melonjs.js"></script>
|
|
177
|
+
<!-- load the ES6 module bundle of melonJS v10.0.0 -->
|
|
178
|
+
<script src="https://cdn.jsdelivr.net/npm/melonjs@10.0.0/dist/melonjs.module.js"></script>
|
|
142
179
|
<!-- omit the version completely to get the latest one -->
|
|
143
180
|
<!-- you should NOT use this in production -->
|
|
144
181
|
<script src="https://cdn.jsdelivr.net/npm/melonjs/dist/melonjs.js"></script>
|
|
145
182
|
<!-- add ".min" to any JS/CSS file to get a minified version -->
|
|
146
|
-
<script src="https://cdn.jsdelivr.net/npm/melonjs@
|
|
147
|
-
```
|
|
148
|
-
and of course the debug panel :
|
|
149
|
-
```html
|
|
150
|
-
<!-- load the latest debug panel -->
|
|
151
|
-
<script src="https://cdn.jsdelivr.net/npm/melonjs/plugins/debug/debugPanel.js"></script>
|
|
152
|
-
<!-- or a specific corresponding release -->
|
|
153
|
-
<script src="https://cdn.jsdelivr.net/npm/melonjs@8.0.1/plugins/debug/debugPanel.js"></script>
|
|
183
|
+
<script src="https://cdn.jsdelivr.net/npm/melonjs@10.0.0/dist/melonjs.min.js"></script>
|
|
154
184
|
```
|
|
155
|
-
|
|
156
|
-
> Note: "official" CDN and NPM install are only available from version 7.0.0 and onwards.
|
|
157
|
-
> Note: ES6 version of melonJS is available from version 9.0.0 and onwards.
|
|
185
|
+
> Note: starting from the 10.0.0 version, the debug plugin is no longer provided as part of the melonJS library release, and has been moved to the official [boilerplate](https://github.com/melonjs/es6-boilerplate)
|
|
158
186
|
|
|
159
187
|
Building melonJS
|
|
160
188
|
-------------------------------------------------------------------------------
|
|
@@ -209,4 +237,12 @@ If you need technical support, you can contact us through the following channels
|
|
|
209
237
|
* [melonJS wikipage](https://github.com/melonjs/melonJS/wiki)
|
|
210
238
|
* [Discord](https://discord.gg/aur7JMk)
|
|
211
239
|
|
|
212
|
-
For any other non technical related questions, feel free to also send us an [email](mailto:contact@melonjs.org)
|
|
240
|
+
For any other non technical related questions, feel free to also send us an [email](mailto:contact@melonjs.org)
|
|
241
|
+
|
|
242
|
+
Sponsors
|
|
243
|
+
-------------------------------------------------------------------------------
|
|
244
|
+
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 !
|
|
245
|
+
|
|
246
|
+
[](https://www.melongaming.com)
|
|
247
|
+
|
|
248
|
+
[]()
|