Description
Commands currently can't communicate with each other except through shared state. Games often need:
- Fire-and-forget events ("enemy died", "player hit")
- Commands that wait for specific events
- Broadcasting state changes across the command tree
Suggested API
// WaitForEvent command
WaitForEvent.create('enemyDied');
// Fire events from commands
this.emit('damageDealt', { amount: 50 });
// Or at the player/enumerator level
commandPlayer.on('damageDealt', handler);
commandPlayer.emit('damageDealt', data);
Additional Context
Without this, developers end up passing callback functions through constructors or using external event buses. A built-in solution would reduce boilerplate for common game patterns like "play death animation when health reaches zero".
Description
Commands currently can't communicate with each other except through shared state. Games often need:
Suggested API
Additional Context
Without this, developers end up passing callback functions through constructors or using external event buses. A built-in solution would reduce boilerplate for common game patterns like "play death animation when health reaches zero".