@newkrok/nape-js 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.
- package/README.md +25 -0
- package/js/libs/nape-js.js +135569 -0
- package/js/libs/nape-js.min.js +1 -0
- package/js/libs/nape-js.module.js +9 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Nape Physics Engine compiled to JavaScript
|
|
2
|
+
|
|
3
|
+
- Original code by Luca Deltodesco https://github.com/deltaluca/nape
|
|
4
|
+
- JS compiler by Andrew Bradley https://github.com/cspotcode/nape-to-js
|
|
5
|
+
|
|
6
|
+
# How to use?
|
|
7
|
+
Here is a simple example which demonstrate the getter/setter problem and solution.
|
|
8
|
+
```
|
|
9
|
+
import initNape from "./js/libs/nape-js.module.js";
|
|
10
|
+
|
|
11
|
+
initNape();
|
|
12
|
+
const space = new nape.space.Space(new nape.geom.Vec2(0, 350));
|
|
13
|
+
|
|
14
|
+
const body = new nape.phys.Body(nape.phys.BodyType.get_STATIC());
|
|
15
|
+
body
|
|
16
|
+
.get_shapes()
|
|
17
|
+
.add(new nape.shape.Polygon(nape.shape.Polygon.box(100, 100)));
|
|
18
|
+
body.get_position().set_x(200);
|
|
19
|
+
body.get_position().set_y(50);
|
|
20
|
+
body.set_rotation(Math.PI / 2);
|
|
21
|
+
body.set_space(space);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
# Some additional info
|
|
25
|
+
Since it's more than 2MB and it's really just a compiled version by haxe, it's not really easy to use, probably it will be only interesting for you when you have a Haxe project and you want to easily rewrite it in vanilla JavaScript.
|