Skip to content

Commit

Permalink
Merge branch 'master' into errorRefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
asanzo authored Aug 13, 2022
2 parents 19aef87 + 7d05308 commit bbcb0df
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pilas-bloques-exercises",
"version": "1.2.13",
"version": "1.2.15",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
Binary file added src/assets/casilla.alien_curva.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 40 additions & 32 deletions src/escenas/AlienInicial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,44 @@
/// <reference path = "../actores/ManzanaAnimada.ts" />

class AlienInicial extends EscenaActividad {
fondo;
cuadricula;
automata;
estado;
boton;
fondoCuadricula;

iniciar() {
this.estado=this.armarEstado();
this.fondo = new Fondo('fondos.alien-inicial.png',0,0);
this.cuadricula = new Cuadricula(-25, -200, 1, 4,
{ alto: 25, ancho: (pilas.opciones.ancho * 0.8) },
{ grilla: 'invisible.png', cantColumnas: 1 });

this.fondoCuadricula = new Actor("camino-alien-boton.png", this.cuadricula.x, this.cuadricula.y);
this.fondoCuadricula.ancho = this.cuadricula.ancho;

this.automata = new AlienAnimado(0,0);
this.cuadricula.agregarActorEnPerspectiva(this.automata,0,0, false);

this.boton = new BotonAnimado(0, 0);
this.boton.derecha = this.cuadricula.derecha + 25;
this.boton.abajo = this.cuadricula.arriba;

}

private armarEstado() {
var a = new BuilderStatePattern(this, 'inicial');
a.agregarEstadoAceptacion('final');
a.agregarTransicion('inicial', 'final', 'apretarBoton');
return a.estadoInicial();
}
fondo;
cuadricula;
automata;
estado;
boton;
fondoCuadricula;

iniciar() {
this.estado = this.armarEstado();
this.fondo = new Fondo('fondos.alien-inicial.png', 0, 0);
this.agregarCuadricula()

this.automata = new AlienAnimado(0, 0);
this.cuadricula.agregarActorEnPerspectiva(this.automata, 0, 0, false);

this.agregarBotones()

}

agregarCuadricula() {
this.cuadricula = new Cuadricula(-25, -200, 1, 4,
{ alto: 25, ancho: (pilas.opciones.ancho * 0.8) },
{ grilla: 'invisible.png', cantColumnas: 1 });

this.fondoCuadricula = new Actor("camino-alien-boton.png", this.cuadricula.x, this.cuadricula.y);
this.fondoCuadricula.ancho = this.cuadricula.ancho;
}

agregarBotones() {
this.boton = new BotonAnimado(0, 0);
this.boton.derecha = this.cuadricula.derecha + 25;
this.boton.abajo = this.cuadricula.arriba;
}

armarEstado() {
var a = new BuilderStatePattern(this, 'inicial');
a.agregarEstadoAceptacion('final');
a.agregarTransicion('inicial', 'final', 'apretarBoton');
return a.estadoInicial();
}
}
48 changes: 48 additions & 0 deletions src/escenas/NuevosComandos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/// <reference path = "AlienInicial.ts" />

class NuevosComandos extends AlienInicial {
iniciar() {
super.iniciar()
this.automata.y -= 20
this.automata.x -= 11
}

agregarCuadricula() {
this.cuadricula = new CuadriculaEsparsa(0, 0, { alto: 300, ancho: 250, separacionEntreCasillas: 5 },
{ grilla: 'casilla.alien_curva.png' }, this.matriz());
this.colorearPrimeraColumna()
}

matriz() {
return [
['T', 'T', 'T'],
['T', 'F', 'T'],
['T', 'F', 'F'],
['T', 'T', 'T'],
['T', 'F', 'T']
]
}

armarEstado() {
return new EstadoParaContarBuilder(this, 'apretarBoton', 5).estadoInicial();
}

agregarBotones() {
[0, 1, 3, 4].forEach(y => this.agregarBoton(2, y))
this.agregarBoton(0, 4)
}

agregarBoton(x, y) {
const boton = new BotonAnimado(0, 0)
this.cuadricula.agregarActorEnPerspectiva(boton, y, x, false)
boton.escala *= 0.83
boton.x += 30
boton.y -= 28.5
}

colorearPrimeraColumna() {
[0, 1, 2, 3, 4].forEach(fila => this.cuadricula.casilla(fila, 0).cambiarImagen('casillas.alien_inicial.png'))
}


}

0 comments on commit bbcb0df

Please sign in to comment.