Update app.js

pull/1886/head
pidajo 2022-06-06 14:11:00 +02:00 committed by GitHub
parent fe5c293c46
commit bb1f8d6c2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 83 additions and 84 deletions

View File

@ -22,8 +22,7 @@ class Ball {
let test = false;
if (isLeft) {
test = this.x <= that.w + this.w && this.y > that.y && this.y < that.y + that.h;
}
else {
} else {
test = this.x >= that.x + this.w && this.y > that.y && this.y < that.y + that.h;
}
if (test) {
@ -101,8 +100,7 @@ class Paddle {
}
if (this.score < value) {
this.score++;
}
else {
} else {
this.score = value;
}
}
@ -112,8 +110,7 @@ class Paddle {
if (this.follow && !this.hasLost) {
var dy = this.follow.y - this.y - this.h / 2;
this.y += dy / 2;
}
else {
} else {
this.y += (this.target - this.y) / 10;
}
if (this.y < 0) {
@ -126,6 +123,7 @@ class Paddle {
}
var updateTimeout = null;
function update() {
var d = new Date();
var lastStep = Date.now();
@ -212,6 +210,7 @@ function stop() {
}
var pauseTimeout = null;
function pause() {
stop();
left.scored();