setup()
setup() runs once when the game starts. It initializes the canvas size and frame rate. The actual game objects (players) are created later when initArena() is called.
function setup() {
createCanvas(960, 600);
frameRate(60);
}
Line-by-line explanation (2 lines)
createCanvas(960, 600);- Creates a 960x600 pixel canvas where the game arena will be drawn
frameRate(60);- Sets the animation to run at 60 frames per second, standard for smooth game animation