From 376719daf5bb21d77320adb5aadc25da058e7035 Mon Sep 17 00:00:00 2001 From: kwichmann Date: Fri, 16 Dec 2016 13:31:01 +0100 Subject: [PATCH 1/2] Ship now spins around center of gravity --- ship.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ship.js b/ship.js index 6861156..a72d1da 100644 --- a/ship.js +++ b/ship.js @@ -83,7 +83,7 @@ function Ship(pos, r) { rotate(this.heading); fill(0); stroke(255); - triangle(-this.r, -this.r, -this.r, this.r, this.r, 0); + triangle(-2/3*this.r, -this.r, -2/3*this.r, this.r, 4/3*this.r, 0); if(this.accelMagnitude != 0) { translate(-this.r, 0); From d528cae984418d0f7805a632eb7d6dcf04633a22 Mon Sep 17 00:00:00 2001 From: kwichmann Date: Fri, 16 Dec 2016 19:37:42 +0100 Subject: [PATCH 2/2] Collision detection changed to match new ship rendering --- ship.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ship.js b/ship.js index a72d1da..2fde08d 100644 --- a/ship.js +++ b/ship.js @@ -49,9 +49,9 @@ function Ship(pos, r) { this.hits = function(asteroid) { var vertices = [ - createVector(this.pos.x - this.r, this.pos.y - this.r), - createVector(this.pos.x - this.r, this.pos.y + this.r), - createVector(this.pos.x + this.r, this.pos.y + 0) + createVector(this.pos.x - 2/3 * this.r, this.pos.y - this.r), + createVector(this.pos.x - 2/3 * this.r, this.pos.y + this.r), + createVector(this.pos.x + 4/3 * this.r, this.pos.y + 0) ]; var asteroid_vertices = asteroid.vertices(); for(var i = 0; i < asteroid_vertices.length; i++) {