mirror of https://github.com/espruino/BangleApps
Update app.js
parent
fe5c293c46
commit
bb1f8d6c2b
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue