kutuluk / js13k-ecs Goto Github PK
View Code? Open in Web Editor NEWA 1kb entity component system, designed for Js13kGames
License: MIT License
A 1kb entity component system, designed for Js13kGames
License: MIT License
When importing the library using an import
statement on node, it crashes because of the following line:
Line 186 in e598de7
The reason is that performance
is not defined and ESM imports run files in strict mode.
I'm using js13k-ecs in a roguelike project for pretty much everything in the game. It's going along great but I ran into a little hurdle that I hadn't quite decided how to overcome. Basically, I created a set of Entity classes that collected all the necessary bits and threw them into the ECS for me during the constructor. Essentially freeing me up to simply put down let player = new Player(...);
and end up with everything in place.
All fine and dandy until I realized that my player
object was not a part of the Entity class itself and therefore would need constant workaround of stuff like player.entity
to access the ECS belonging to the object, and by extension any related components.
To simplify, I thought I could extend the js13k-ecs Entity
class so that the Player
class would play well (hah) with the ECS directly. Sadly, the Entity class is not exported so that's not possible.
What I'm curious about is, am I breaking something or doing something wrong if I simply added the export keyword to the Entity
class in my version (and, should we add it to the entire module this way)? I'm self-taught at JS and it's entirely possible that I've missed something obvious. I appreciate any feedback you have. Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.