diff options
| author | s1n <[email protected]> | 2019-10-19 21:06:57 -0700 |
|---|---|---|
| committer | s1n <[email protected]> | 2019-10-19 21:06:57 -0700 |
| commit | 25e2c93af45c504ffb67b259dba86ebea09fb02c (patch) | |
| tree | 7696d4a03d7422e936db5f470c5006301c293906 /cars/js | |
| parent | add oauth2 (diff) | |
| download | s1n.pw-admin-25e2c93af45c504ffb67b259dba86ebea09fb02c.tar.xz s1n.pw-admin-25e2c93af45c504ffb67b259dba86ebea09fb02c.zip | |
formatting and linking for cars
Diffstat (limited to 'cars/js')
| -rw-r--r-- | cars/js/main.js | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/cars/js/main.js b/cars/js/main.js index 3a24c8e..c8c88fc 100644 --- a/cars/js/main.js +++ b/cars/js/main.js @@ -1,4 +1,4 @@ -// rendered-js +// Visable JavaScript class Wall { constructor(x, y, w, h, a) { var options = { @@ -124,20 +124,20 @@ class Wall { rectMode(CENTER); translate(this.body.position.x, this.body.position.y); rotate(angle); - // tires + // Car Tires fill(54); ellipse(this.length / 3, -this.width / 2, this.width / 4, this.width / 8); ellipse(this.length / 3, this.width / 2, this.width / 4, this.width / 8); ellipse(-this.length / 3, -this.width / 2, this.width / 4, this.width / 8); ellipse(-this.length / 3, this.width / 2, this.width / 4, this.width / 8); - // car body + // Car Body fill(this.color); rect(0, 0, this.length, this.width, 5); fill(54); rect(-this.length / 24, 0, 0.7 * this.length, 0.8 * this.width, 5); fill(this.color); rect(-this.length / 12, 0, 0.45 * this.length, 0.6 * this.width, 5); - // headlights + // Car Headlights fill(255, 255, 200); ellipse(this.length / 2, -this.width / 3, this.width / 8, this.width / 4); ellipse(this.length / 2, this.width / 3, this.width / 8, this.width / 4); @@ -165,9 +165,9 @@ class Wall { this.lifespan = 255; this.vel = createVector(random(0, xVel), random(-xVel, xVel)); - // we just want the direction + // Get Direction this.vel.normalize(); - // then add random speed + // Add Random Speed this.vel.mult(random(0, 20)); this.fill = [random(255), random(255), random(255)]; } @@ -205,7 +205,7 @@ class Wall { let computerCar; let ball; - // for goal explosion effect + // Goal Explosion Effect let sparks = []; let goalHeight; @@ -216,7 +216,7 @@ class Wall { function setup() { const h = min(window.innerHeight, window.innerWidth * 0.61); - // keep field dimensions nice + // keep field dimensions nice :) const w = min(window.innerWidth, h * 1.64); createCanvas(w, h); @@ -226,7 +226,7 @@ class Wall { engine = Engine.create(); world = engine.world; - // disable matter.js gravity + // Disable matter.js Gravity engine.world.gravity.y = 0; addWalls(); @@ -317,13 +317,13 @@ class Wall { text("GOOOOOOAL", width / 2 - 200, height / 2); } - // update, show, and delete sparks for goals + // Update, show, and delete sparks for goals goSparksGo(); } function shootSparks(x, y) { - // shoot sparks in opposite direction (towards middle) + // Shoot sparks in opposite direction (towards middle) const xVel = x < width / 2 ? 10 : -10; const xPos = x < width / 2 ? 0 : width; for (var i = 0; i < 50; i++) { @@ -335,7 +335,7 @@ class Wall { } function goSparksGo() { - // go backwards through array in case we splice (will break if forwards) + // Go backwards through array in case we splice (will break if forwards) <- lol for (var i = sparks.length - 1; i >= 0; i--) { if (window.CP.shouldStopExecution(1)) break; sparks[i].update(); @@ -353,17 +353,17 @@ class Wall { stroke(55); strokeWeight(1); - // center field line + // Center Field Line line(width / 2, 0, width / 2, height); ellipse(width / 2, height / 2, width / 6); - // left goalie box + // left Goalie Box rect(0, height / 2 - width / 6, width / 6, width / 3); stroke(255, 100, 100); rect(0, height / 2 - width / 12, width / 18, goalHeight); strokeWeight(10); line(0, height / 2 - width / 12, 0, height / 2 - width / 12 + goalHeight); - // right goalie box + // Right Goalie Box strokeWeight(1); stroke(0); rect(width - width / 6, height / 2 - width / 6, width / 6, width / 3); @@ -384,5 +384,4 @@ class Wall { leftWall = new Wall(-wt2, height / 2, height, wallThickness, PI / 2); rightWall = new Wall(width + wt2, height / 2, height, wallThickness, PI / 2); - } - //# sourceURL=pen.js
\ No newline at end of file + }
\ No newline at end of file |