Snippet - Sin/Cos functions

Instead of using emit to call these functions I would use tell event.game and call. emit has to ask the game, current room, player, and all 375 tiles in the current room if they handle the emitted event. That’s a lot more overhead than directly tell-ing the single object you already know implements the event handler. (And that overhead is only being compounded by calling it 20 frames per second in the draw event handler. I would move the sin/cos calculations and setting of x,y to the player’s crank event handler.)

1 Like