Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Latest commit

 

History

History
23 lines (16 loc) · 819 Bytes

system.md

File metadata and controls

23 lines (16 loc) · 819 Bytes

System holds logic

System is basically just wrapper around the piece of code representing game mechanics. It can be really simple. Over complicated systems are much harder to read, test, maintain and debug. Keep that in mind when designing your systems.

Defining the system

System doesn't need to be instantiated like other parts of the framework. System is defined by a plain function which is run once when Engine is started to actually setup its logic.

	function sWorker($engine) {
		var nStructure = new Scent.Node('building', 'foundating');
		
		$engine.onUpdate(function() {
			nStructure.each(loopNode);
		});

		function loopNode(node) {
			// Worker can "build" the structure by adding more components to entity
		};
	};

Currently there is no way to remove the system from the Engine.