[Title] Modify the coordinate formula
[Issue#] N_SE-40704
[Problem] The ball should not bounce on bottom right of the screen.
[Solution] Modify the coordinate formula
Change-Id: I86bc421ea88a1bc30a68b8d46e60bba32ca67d2c
vx = vx * 0.98;
vy = vy * 0.98;
- x = parseInt(x + (vx / 20));
- y = parseInt(y + (vy / 20));
+ x = parseInt(Math.round(x + (vx / 20)));
+ y = parseInt(Math.round(y + (vy / 20)));
// Bound Check
- if (x < 0) {
+ if (x <= 0) {
x = 0;
vx = -vx;
}
- if (y < 0) {
+ if (y <= 0) {
y = 0;
vy = -vy;
}
- if (x > document.documentElement.clientWidth - 80) {
+ if (x >= document.documentElement.clientWidth - 80) {
x = document.documentElement.clientWidth - 80;
vx = -vx;
}
- if (y > document.documentElement.clientHeight - 80) {
+ if (y >= document.documentElement.clientHeight - 80) {
y = document.documentElement.clientHeight - 80;
vy = -vy;
}