xxxxxxxxxx
gravity = 0.09
function draw() {
background(0, 200, 255)
push();
screenSize = findScreenSize() // Calculate the screen size and store it in a varible
screen(screenSize) // Update the screen with screenSize
draw2() // This function makes it easier to draw things because it tranlslates the image based on zoom
pop();
push()
textSize(75);
noStroke();
fill(0, 200, 255);
const scoreWidth = textWidth(String(round(score))) + 6;
rect(width / 2 - scoreWidth / 2, 60, scoreWidth, 66);
rect(width - 105, 0, 105, 35);
fill(255);
text(round(score), width / 2, 120);
textSize(30)
text(round(highScore) + "♛", width - 50, 30)
pop()
screen(screenSize) // Update the screen with screenSize
drawGround()
player.controls() // Allows the user to control the ball which changes the velocities
player.updateForces() // The normal force and gravity will be calculated and then added to the velocities
player.updatePos() // The x and y coordinates will be changed by their velocities
player.draw() // Draw the player onto the screen at the x and y coordinates'
isGameOver(player.normalForceY) // Check if the game is over with the Y normal force
}