Jump to content

How to use an Entity-component system with Phaser?


evanwalsh
 Share

Recommended Posts

Hello! I'm puzzling through how one would use an Entity-Component System with Phaser. Normally, I'd add a Sprite component to an Entity, but Sprites in Phaser are kind of like entities, in that they are more than just a texture. Also, Sprites are added to the Game, which then handles rendering them. Normally an ECS-style System would handle their display, so I'm feeling a bit lost.

 

How do I use an ECS with Phaser? Specifically, I'm trying to use ces.js, but if someone has a better library, let me know!

 

Thanks!

Link to comment
Share on other sites

KiwiJs is supposed to be using the ECS pattern.  That is according to it's listed features on the main page.  I haven't actually looked at any of the code, so I can't speak to how well it's implemented.

 

One thing to note:  Crafty isn't really ECS.  It's more EC.

 

From the wiki article you pointed to: System: "Each System runs continuously (as though each System had its own private thread) and performs global actions on every Entity that possesses a Component of the same aspect as that System."

 

Where distinct systems would normally contain logic, Crafty bundles logic with components instead.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...