Skip to content

Commit

Permalink
Merge pull request #67 from Program-AR/fixing-giant-lata
Browse files Browse the repository at this point in the history
Bug - lata gigante
  • Loading branch information
dlopezalvas authored Feb 23, 2024
2 parents e9e2da7 + 71c9f03 commit ebab2b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/comportamientos/Achicar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand All @@ -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 ebab2b8

Please sign in to comment.