summaryrefslogtreecommitdiff
path: root/lib/serpentity/system.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serpentity/system.js')
-rw-r--r--lib/serpentity/system.js58
1 files changed, 35 insertions, 23 deletions
diff --git a/lib/serpentity/system.js b/lib/serpentity/system.js
index c817be1..339f6e7 100644
--- a/lib/serpentity/system.js
+++ b/lib/serpentity/system.js
@@ -1,32 +1,44 @@
+'use strict';
+
+/* global Serpentity */
+
/*
* Systems contain most of the logic, and work with nodes in order to
* act and change their values.
*
* You usually want to inherit from this class and override the
- * three methods.
+ * three methods. They are shown here to document the interface.
*/
-Class(Serpentity, "System")({
- prototype : {
- /*
- * This will be run when the system is added to the engine
- */
- added : function added(engine) {
- // Override
- },
+let System = class System {
+
+ /*
+ * This will be run when the system is added to the engine
+ */
+ added () {
+ // Override with added(engine)
+ // Receives an instance of the serpentity engine
+ }
+
+ /*
+ * This will be run when the system is removed from the engine
+ */
+ removed () {
+ // Override with removed(engine)
+ // Receives an instance of the serpentity engine
+ }
- /*
- * This will be run when the system is removed from the engine
- */
- removed : function removed(engine) {
- // Override
- },
+ /*
+ * This will run every time the engine's update method is called
+ */
+ update () {
+ // Override with update(dt)
+ // Receives a delta of the time
+ }
+};
- /*
- * This will run every time the engine's update method is called
- */
- update : function update(dt) {
- // Override
- }
- }
-});
+if (typeof module !== 'undefined' && this.module !== module) {
+ module.exports = System;
+} else {
+ Serpentity.System = System;
+}