Any examples how to spawn an object in a multiplayer game Phaser + Colyseust? Please, help me.
I have objects spawn every 20 seconds in a game Iām building with Phaser/Colyseus/Matter js. In the back end I just have a setInterval set to 20000, it picks random coords at every interval and sets those coords to the state. Then on the front end I have an onChange function so that whenever the state of the coords change it spawns an object at those coords for all clients. Basically change the state in the back end when you want to spawn an object and use onChange function on the front end to display that object. Hope that helps.