From 09385d0d087b2dc88a51da6be0cff9bd0deb36a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Fri, 23 Feb 2024 01:09:24 -0300 Subject: [PATCH 1/2] fixing lata gigante :) --- src/comportamientos/Achicar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/comportamientos/Achicar.ts b/src/comportamientos/Achicar.ts index a526649..958a279 100644 --- a/src/comportamientos/Achicar.ts +++ b/src/comportamientos/Achicar.ts @@ -6,7 +6,7 @@ class Achicar extends ComportamientoAnimado { private contador: number elReceptorSeAchico(): boolean { - return this.receptor.getAncho() <= 1 + return this.receptor.getAncho() <= 1 || this.receptor.getAlto() <= 1 } /** From 71c9f0331ce1be5a6990ceea1704e6f476720146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diana=20L=C3=B3pez=20Alvas?= Date: Fri, 23 Feb 2024 02:04:36 -0300 Subject: [PATCH 2/2] adding math.max 0 --- src/comportamientos/Achicar.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/comportamientos/Achicar.ts b/src/comportamientos/Achicar.ts index 958a279..07026d7 100644 --- a/src/comportamientos/Achicar.ts +++ b/src/comportamientos/Achicar.ts @@ -24,9 +24,9 @@ class Achicar extends ComportamientoAnimado { } else { - this.contador = (this.contador + this.velocidad) - this.receptor.setAlto(this.receptor.getAlto() - this.contador); - this.receptor.setAncho(this.receptor.getAncho() - this.contador); + this.contador = (this.contador + this.velocidad) + this.receptor.setAlto(Math.max(0, this.receptor.getAlto() - this.contador)); + this.receptor.setAncho(Math.max(0, this.receptor.getAncho() - this.contador)); if (this.elReceptorSeAchico()) { this.receptor.eliminar()