aboutsummaryrefslogtreecommitdiff
path: root/lib/nodes
diff options
context:
space:
mode:
authorRubén Beltrán del Río <ben@nsovocal.com>2018-04-21 17:45:38 -0500
committerGitHub <noreply@github.com>2018-04-21 17:45:38 -0500
commit493ec31cb19b4211c703762d14a4e6232c4c2143 (patch)
treec0c33fab8f2fb040dc714ab76f0eb5479f001b2e /lib/nodes
parent0616b3f00653c66b5e34814653e33413b9ec034e (diff)
Physics Engine (#4)
* Add matter-js as a dependency * Add body component * Fix renderable node doc * Add the physics node type * Correct typo in physics enabled node types * Update docs on render system * Add physics system * Update changelog * Add physics engine to main app * Tweak the gravity of the world * Add body to sumo factory * Add angle component * Add angle to entity * Add angle to the nodes * Pass angle between systems * Set default angle to 0 * Split systems and nodes * Fix indentaion in physics world control * Add third sumo entity * Adjust values for constriants and physics * Correct docs in new nodes * Update built-in docs
Diffstat (limited to 'lib/nodes')
-rw-r--r--lib/nodes/physical.js26
-rw-r--r--lib/nodes/physical_with_attributes.js31
-rw-r--r--lib/nodes/renderable.js9
-rw-r--r--lib/nodes/renderable_couple.js28
-rw-r--r--lib/nodes/renderable_with_attributes.js30
5 files changed, 118 insertions, 6 deletions
diff --git a/lib/nodes/physical.js b/lib/nodes/physical.js
new file mode 100644
index 0000000..77139ec
--- /dev/null
+++ b/lib/nodes/physical.js
@@ -0,0 +1,26 @@
+import { Node } from '@serpentity/serpentity';
+
+import BodyComponent from '../components/body';
+
+/**
+ * Node identifying an entity that can interact with physics
+ *
+ * @extends {external:Serpentity.Node}
+ * @class PhysicalNode
+ */
+export default class PhysicalNode extends Node {
+
+};
+
+/**
+ * Holds the types that are used to identify an entity with a physical
+ * body
+ *
+ * @property {object} types
+ * @name types
+ * @memberof PhysicalNode
+ */
+PhysicalNode.types = {
+ body: BodyComponent
+};
+
diff --git a/lib/nodes/physical_with_attributes.js b/lib/nodes/physical_with_attributes.js
new file mode 100644
index 0000000..96ba79d
--- /dev/null
+++ b/lib/nodes/physical_with_attributes.js
@@ -0,0 +1,31 @@
+import { Node } from '@serpentity/serpentity';
+
+import AngleComponent from '../components/angle';
+import BodyComponent from '../components/body';
+import PositionComponent from '@serpentity/components.position';
+
+/**
+ * Node identifying an entity that can interact with physics and has
+ * components updated from its values
+ *
+ * @extends {external:Serpentity.Node}
+ * @class PhysicalWithAttributesNode
+ */
+export default class PhysicalWithAttributesNode extends Node {
+
+};
+
+/**
+ * Holds the types that are used to identify an entity with a physics
+ * object and external attributes
+ *
+ * @property {object} types
+ * @name types
+ * @memberof PhysicalWithAttributesNode
+ */
+PhysicalWithAttributesNode.types = {
+ angle: AngleComponent,
+ position: PositionComponent,
+ body: BodyComponent
+};
+
diff --git a/lib/nodes/renderable.js b/lib/nodes/renderable.js
index 0a3a111..12227a3 100644
--- a/lib/nodes/renderable.js
+++ b/lib/nodes/renderable.js
@@ -1,11 +1,9 @@
import { Node } from '@serpentity/serpentity';
import PixiContainerComponent from '../components/pixi_container';
-import PositionComponent from '@serpentity/components.position';
/**
- * Node identifying a renderable entity, should have position and a
- * symbol to render
+ * Node identifying a renderable entity, should have a pixi renderable
*
* @extends {external:Serpentity.Node}
* @class RenderableNode
@@ -15,13 +13,12 @@ export default class RenderableNode extends Node {
};
/**
- * Holds the types that are used to identify a wave entity
+ * Holds the types that are used to identify a renderable entity
*
* @property {object} types
* @name types
- * @memberof WaveNode
+ * @memberof RenderableNode
*/
RenderableNode.types = {
- position: PositionComponent,
container: PixiContainerComponent
};
diff --git a/lib/nodes/renderable_couple.js b/lib/nodes/renderable_couple.js
new file mode 100644
index 0000000..39ab886
--- /dev/null
+++ b/lib/nodes/renderable_couple.js
@@ -0,0 +1,28 @@
+import { Node } from '@serpentity/serpentity';
+
+import CoupledEntitiesComponent from '../components/coupled_entities';
+import PixiContainerComponent from '../components/pixi_container';
+
+/**
+ * Node identifying an entity that has coupled entities and can be
+ * rendered
+ *
+ * @extends {external:Serpentity.Node}
+ * @class RenderableCoupleNode
+ */
+export default class RenderableCoupleNode extends Node {
+
+};
+
+/**
+ * Holds the types that are used to identify a renderable couple
+ *
+ * @property {object} types
+ * @name types
+ * @memberof RenderableCoupleNode
+ */
+RenderableCoupleNode.types = {
+ coupledEntities: CoupledEntitiesComponent,
+ container: PixiContainerComponent
+};
+
diff --git a/lib/nodes/renderable_with_attributes.js b/lib/nodes/renderable_with_attributes.js
new file mode 100644
index 0000000..817036c
--- /dev/null
+++ b/lib/nodes/renderable_with_attributes.js
@@ -0,0 +1,30 @@
+import { Node } from '@serpentity/serpentity';
+
+import AngleComponent from '../components/angle';
+import PixiContainerComponent from '../components/pixi_container';
+import PositionComponent from '@serpentity/components.position';
+
+/**
+ * Node identifying a renderable entity, should have position and a
+ * symbol to render
+ *
+ * @extends {external:Serpentity.Node}
+ * @class RenderableWithAttributesNode
+ */
+export default class RenderableWithAttributesNode extends Node {
+
+};
+
+/**
+ * Holds the types that are used to identify a renderable with external
+ * attributes
+ *
+ * @property {object} types
+ * @name types
+ * @memberof RenderableWithAttributesNode
+ */
+RenderableWithAttributesNode.types = {
+ angle: AngleComponent,
+ position: PositionComponent,
+ container: PixiContainerComponent
+};