Skip to content

Commit

Permalink
adding math.max 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dlopezalvas committed Feb 23, 2024
1 parent 09385d0 commit 71c9f03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/comportamientos/Achicar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 71c9f03

Please sign in to comment.