aboutsummaryrefslogtreecommitdiff
path: root/lib/components/points_collider.js
diff options
context:
space:
mode:
authorRubén Beltrán del Río <ben@nsovocal.com>2018-05-29 02:34:38 -0500
committerGitHub <noreply@github.com>2018-05-29 02:34:38 -0500
commit3100e0533cb89a185ea021dfb83c4f364750180f (patch)
treea957c7efc0b1d1e5f1ddafd69e2bfd39c70b50df /lib/components/points_collider.js
parent43413defcb854c8706a84a6a54a61c7977b52614 (diff)
Add Naive Game Rules (#11)
* Add components for tracking points * Add methods to create new entities * Adds nodes for points * Add system to detect points * Adds system to detect a winner * Add system to render points and winner * Add points required to win to config * Add it all to the engine * Add mention of points to changelog
Diffstat (limited to 'lib/components/points_collider.js')
-rw-r--r--lib/components/points_collider.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/components/points_collider.js b/lib/components/points_collider.js
new file mode 100644
index 0000000..ceec7ee
--- /dev/null
+++ b/lib/components/points_collider.js
@@ -0,0 +1,35 @@
+import { Component } from '@serpentity/serpentity';
+
+/**
+ * Component that stores a collision target and points accumulation
+ * target
+ *
+ * @extends {external:Serpentity.Component}
+ * @class PointsColliderComponent
+ * @param {object} config a configuration object to extend.
+ */
+export default class PointsColliderComponent extends Component {
+ constructor(config) {
+
+ super(config);
+
+ /**
+ * The target entity that will generate points if it collides
+ *
+ * @property {external:Serpentity.Entity} collisionTarget
+ * @instance
+ * @memberof PointsColliderComponent
+ */
+ this.collisionTarget = this.collisionTarget || null;
+
+ /**
+ * The target entity that will generate points if it collides
+ *
+ * @property {string} pointsTarget
+ * @instance
+ * @memberof PointsColliderComponent
+ */
+ this.pointsTarget = this.pointsTarget || 'nobody';
+ }
+};
+