Operators

Table of Contents



Mathematical

Utilized standard arithmetic operators such as +, +=, -, to calculate real-time physics behaviors. This includes updating vertical displacement using acceleration

this.vy += this.gravity;

player.position.y += this.vy;
const dist = Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));



String Operations

Combined binary string concatenation with literals like backticks and ${} to handle asset routing.

<p style="color: white; font-size: 22px; margin-bottom: 20px ">Time: ${timeTaken}s</p>
id: 'player', src: gameEnv.path + "/images/projects/red-riding/red.png",



Boolean Expressions

Implemented compound logical operators. These boolean expressions ensure multi-variable dependencies are checked, and that a victory is met using the NOT operator.

if (currentScore >= 5 && !this.scoreSubmitted)
if (!player?.position || !wolf?.position)