Refactor/entities splitting #4

Merged
ilia merged 18 commits from refactor/entities-splitting into main 2026-07-18 08:02:47 +00:00
Showing only changes of commit a4f56674a7 - Show all commits
+12
View File
@@ -14,4 +14,16 @@ export class Paddle {
this.width = width;
this.height = height;
}
/**
* Ограничивает минимальные и максимальные координаты положения ракетки на оси X
* @param {number} containerWidth ширина игрового поля
*/
clampTo(containerWidth) {
if (this.x <= 0) {
this.x = 0;
} else if (this.x >= containerWidth - this.width) {
this.x = containerWidth - this.width;
}
}
}