From f9da8dbe928902934a77e1b0b56f8154ddbfff9f Mon Sep 17 00:00:00 2001 From: lambtoken Date: Sat, 23 Dec 2023 09:37:03 +0100 Subject: [PATCH 1/4] Added missing do keyword in the loops --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7211e4..8f4d7b5 100644 --- a/README.md +++ b/README.md @@ -294,14 +294,14 @@ end -- Defining a function function mySystemClass:update(dt) -- Iterate over all entities in the Pool - for _, e in ipairs(self.pool) + for _, e in ipairs(self.pool) do -- Do something with the Components e.position.x = e.position.x + e.velocity.x * dt e.position.y = e.position.y + e.velocity.y * dt end -- Iterate over all entities in the second Pool - for _, e in ipairs(self.secondPool) + for _, e in ipairs(self.secondPool) do -- Do something end end From 1aaf50140135e5793b362a862cd15e8f0cfc52f0 Mon Sep 17 00:00:00 2001 From: Justin van der Leij Date: Mon, 27 May 2024 13:53:55 +0200 Subject: [PATCH 2/4] Update README.md to hint that components should be loaded for systems --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f7211e4..168db64 100644 --- a/README.md +++ b/README.md @@ -133,16 +133,16 @@ Concord does a few things that might not be immediately clear. This segment shou Since you'll have lots of Components and Systems in your game Concord makes it a bit easier to load things in. ```lua +-- Loads all files in the directory. Components automatically register into Concord.components, so loading them into a namespace isn't necessary. +Concord.utils.loadNamespace("path/to/components") + +print(Concord.components.componentName) + -- Loads all files in the directory, and puts the return value in the table Systems. The key is their filename without any extension local Systems = {} Concord.utils.loadNamespace("path/to/systems", Systems) print(Systems.systemName) - --- Loads all files in the directory. Components automatically register into Concord.components, so loading them into a namespace isn't necessary. -Concord.utils.loadNamespace("path/to/components") - -print(Concord.components.componentName) ``` #### Method chaining From 6575686b3bb5abfb2e9c477762c2de38f22f40a5 Mon Sep 17 00:00:00 2001 From: Denis Defreyne Date: Sat, 29 Jun 2024 10:28:12 +0200 Subject: [PATCH 3/4] Fix typo in README.md A piece of example code was missing a `,`. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 168db64..987c030 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ When defining a ComponentClass you need to pass in a name and usually a `populat -- Create the position class with a populate function -- The component variable is the actual Component given to an Entity -- The x and y variables are values we pass in when we create the Component -Concord.component("position" function(component, x, y) +Concord.component("position", function(component, x, y) component.x = x or 0 component.y = y or 0 end) From 848652f68887db0c4261efe499facbec88959d03 Mon Sep 17 00:00:00 2001 From: Justin van der Leij Date: Sun, 30 Jun 2024 10:45:46 +0200 Subject: [PATCH 4/4] Make example for how to use Concord.utils.loadNamespace for systems more concrete --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8db02a4..6669d8e 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,12 @@ print(Concord.components.componentName) local Systems = {} Concord.utils.loadNamespace("path/to/systems", Systems) -print(Systems.systemName) +myWorld:addSystems( + Systems.healthSystem + Systems.damageSystem, + Systems.moveSystem, + -- etc +) ``` #### Method chaining