Entities represented by plain objects.
const player = {}
Components represented by entity properties.
The problem with this approach is that string based component keys are not modular.
const player = {
bounds: {
x: 0,
y: 0,
width: 30,
height: 30
},
fill: 'red'
}
Systems represented by callbacks or plain objects with system lifecycle hooks.
function RectangleRendering (engine) {
}
// or
class RectangleRendering {
add (engine) {
}
run (engine) {
}
remove (engine) {
}
}
To query entities, one can use their component names.
function RectangleRendering (engine) {
engine.each(['bounds', 'fill'], (bounds, fill, entity) => {
})
}