aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2020-05-13 22:48:06 -0500
committerMark Powers <markppowers0@gmail.com>2020-05-13 22:48:06 -0500
commitbe1201b6aabc5365cadfff24049fe311d8458c9b (patch)
tree87a46db466314ddf91453aab6f184f4f8a8cdcdc
parent7889250b115eec8709c0c9ff8345e0bef88037b5 (diff)
Fix vent bug, add constant spaced vent air streams
-rw-r--r--src/paperflight/static/draw.js8
-rw-r--r--src/paperflight/static/update.js7
2 files changed, 10 insertions, 5 deletions
diff --git a/src/paperflight/static/draw.js b/src/paperflight/static/draw.js
index 13ecce5..c82974a 100644
--- a/src/paperflight/static/draw.js
+++ b/src/paperflight/static/draw.js
@@ -38,10 +38,10 @@ function drawVent() {
ctx.fillRect(this.x, this.y, this.width, 10)
ctx.fillStyle = "white"
var yDelta = Math.sin(t / 30) * 40
- for (var i = 0; i < this.height; i+= 60) {
- ctx.fillRect(this.x, this.y - i + yDelta, 1, 8)
- ctx.fillRect(this.x+this.width/2-2, this.y - i + yDelta/2, 1, 12)
- ctx.fillRect(this.x+this.width-2, this.y - i + yDelta, 1, 8)
+ for (var i = 40; i < this.height; i+= 60) {
+ for (var j = 0; j < this.width; j+= 30) {
+ ctx.fillRect(this.x+j, this.y - i + yDelta, 1, 8)
+ }
}
}
function drawBlock() {
diff --git a/src/paperflight/static/update.js b/src/paperflight/static/update.js
index ac5c284..b953914 100644
--- a/src/paperflight/static/update.js
+++ b/src/paperflight/static/update.js
@@ -30,7 +30,12 @@ function update() {
}
}
function updateVent() {
- if (isPlaneInBox(this)) {
+ // Custom box since vent height is upwards
+ if (isPlaneInBox({
+ x: this.x,
+ y: this.y-this.height,
+ width: this.width,
+ height: this.height})) {
plane.y -= 2
}
}