Page 4 of 4

Re: [Library] tiny-ecs - Fast Simple Entity Component System

Posted: Thu Feb 23, 2017 11:46 am
by Zireael
Are the two demos by bakpakin the only examples of how to use it? I wanted to change parts of my existing project to a component structure since I'm having problems with loops/diamond problem when using inheritance...

Re: [Library] tiny-ecs - Fast Simple Entity Component System

Posted: Thu Mar 16, 2017 5:59 pm
by emanevitaerc
How can I make a sorted processing system re-sort its entities? I'm using one to sort drawn entities by depth to get them in a proper draw order, but it only sorts them once upon their addition, so after their depth changes they stay in the same position in the draw system's entity list.

Re: [Library] tiny-ecs - Fast Simple Entity Component System

Posted: Sat Mar 18, 2017 4:56 pm
by bakpakin
Try calling sortedSystem:onModify(). This is called once every time new items are added, and resorts the system.

Re: [Library] tiny-ecs - Fast Simple Entity Component System

Posted: Sat Mar 18, 2017 9:27 pm
by emanevitaerc
bakpakin wrote:
Sat Mar 18, 2017 4:56 pm
Try calling sortedSystem:onModify(). This is called once every time new items are added, and resorts the system.
EDIT: Misread your comment, this does work for my intentions. Thanks!

Re: [Library] tiny-ecs - Fast Simple Entity Component System

Posted: Wed Sep 13, 2017 4:40 am
by HanaIndiana
Does anyone have an example of using the world:removeEntity(entity) function? I'm either not using it right, or it's working in a way I'm not expecting. I'm wondering if the system:onRemove(entity) needs to always be included as well. Either way, I'm lost.
The two demos bakpakin has in git (kibbles and weregoat), while helpful, don't use either of these functions.

Here is a short example of one thing I've tried.
If I have an entity called "Word", added to the world like this:
world:add(Word(100,50,assets.lrgfont,"Game Title"))

To remove this entity, would I use this syntax?
world:removeEntity(Word)

I also have a system that uses this Entity, called "WordSystem". And I have a function belonging to this system called:
function WordSystem:onRemove(entity)
But the function doesn't appear to be called when the removeEntity function is used.
Any help is appreciated!