From b2f0810ec2febe5c00b0afe3f8c55f28ffd23053 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Sun, 19 Jul 2026 14:13:05 +0300 Subject: [PATCH] =?UTF-8?q?feat(perk):=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B1=D0=BE=D0=BD=D1=83=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/perk/perk.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/entities/perk/perk.js diff --git a/src/entities/perk/perk.js b/src/entities/perk/perk.js new file mode 100644 index 0000000..56c473c --- /dev/null +++ b/src/entities/perk/perk.js @@ -0,0 +1,31 @@ +/** + * Класс сущности "бонус" + * @class + */ +export class Perk { + /** + * @param {number} x координата положения бонуса по оси X + * @param {number} y координата положения бонуса по оси Y + * @param {number} width положительное числовое значение ширины бонуса + * @param {number} height положительное числовое значение высоты бонуса + * @param {string} type тип бонуса + * @param {number} fallSpeed скорость падения бонуса по оси Y + */ + constructor(x, y, width, height, type, fallSpeed) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.type = type; + this.fallSpeed = fallSpeed; + this.alive = true; + } + + /** + * Смещает бонус вниз в зависимости от времени + * @param {number} deltaTime изменение времени из Ticker + */ + moveForward(deltaTime) { + this.y += this.fallSpeed * deltaTime; + } +}