This might be a naive question but if I have a Player whom has some Player.think() running on each frame and I use that to check the pad and do movement and whatnot, if I want some action to create a Bullet or something do I need to implement a message queue of sorts which is common between the scene and its entities?
For example (excuse the psuedo-code);
(Player)
think() {
if(pad.isDown("spacebar") && this.bulletCooldown <= 0)
this.messages.push(new SpawnBulletMessage(...));
}
(Scene)
think() {
foreach (entity in this.entities)
entity.think();
foreach (msg in this.messages)
this.performMessage(msg);
}
With Player.messages and Scene.messages being the same object.
Is this a common paradigm or is there a better way to do what I'm trying to do?