summaryrefslogtreecommitdiffhomepage
path: root/README.mdown
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-07-10 03:09:36 -0400
committerrealtradam <[email protected]>2021-07-10 03:09:36 -0400
commitaab35c0f098d695b7cf53c14a8b08a9b4a24550d (patch)
tree84dd6b9b5787fce8f1bab84761c80818fea783d7 /README.mdown
parentfea1879f371d5c6d68439b9ab9c64d9a61d92d1c (diff)
downloadFelECS-2.0.0.tar.gz
FelECS-2.0.0.zip
entities and components now reference each other with objects2.0.0
Diffstat (limited to 'README.mdown')
-rw-r--r--README.mdown18
1 files changed, 18 insertions, 0 deletions
diff --git a/README.mdown b/README.mdown
index 9b1e80d..d88a78b 100644
--- a/README.mdown
+++ b/README.mdown
@@ -26,6 +26,7 @@
- [Accessing](#accessing)
- [Get ID](#get-id)
- [Adding and Removing Components](#adding-and-removing-components)
+ - [Accessing Entities' Attached Components](#accessing-entities-attached-components)
- [Deletion](#deletion)
* [Components](#components-1)
- [Creating a Component Manager](#creating-a-component-manager)
@@ -34,6 +35,7 @@
- [Accessing Attributes and Changing Them](#accessing-attributes-and-changing-them)
- [Deleting Components](#deleting-components)
- [Iterating over Components](#iterating-over-components)
+ - [Accessing Components' attached Entities](#accessing-components-attached-entities)
* [Systems](#systems-1)
- [Creation](#creation-1)
- [Execution](#execution)
@@ -142,6 +144,13 @@ We can still add or remove Components from an Entity after it has been created.
@entity.remove @component
```
+### Accessing Entities' Attached Components
+When Components are added to Entities, they can be accessed from the Entity. By using a Component Manager as a key we can access an array of all components created from that Component Manager that are attached to an entity:
+
+```ruby
[email protected][@component_manager] # => [@component1, @component2, component3]
+```
+
### Deletion
To have all Components from an Entity removed and the Entity deleted we do the following:
@@ -210,12 +219,21 @@ Deleting a Component is the same format as deleting an Entity. When a Component
### Iterating over Components
When you make Systems you will want to be able to iterate over all Components of the same Component Manager(for example iterating over all sprites to render them). Here is how we do that:
+
```ruby
FelFlame::Components::Sprites.each do |component|
#do something with components
end
```
+### Accessing Components' attached Entities
+Components also keep track of what Entities are using it. To access this list we do the following:
+
+```ruby
[email protected] # => [@entity1, @entity2, @entity3]
+```
+
+
## Systems
### Creation