Skip to content

Commit

Permalink
Merge branch 'master' into detalles-yacare
Browse files Browse the repository at this point in the history
  • Loading branch information
tfloxolodeiro committed Nov 13, 2023
2 parents 16b9fc3 + 96b7cc8 commit 304aaf8
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 4 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.4.22",
"version": "1.4.24",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
1 change: 1 addition & 0 deletions src/actores/segundoCiclo/Manic/Manic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ManicDibujando extends ActorAnimado {
.concat([26, 27, 28, 29, 30, 31, 32, 33, 34, 35]),
20, true);
this.definirAnimacion("rotar", [0], 1);
this.definirAnimacion("saltar", [0], 1);
this.definirAnimacion("error", [17, 18, 19, 20, 21, 21, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23], 12)
this.definirAnimacion("dibujar", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], 20);
}
Expand Down
23 changes: 23 additions & 0 deletions src/actores/segundoCiclo/Manic/TelescopioAnimado.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference path="../../ActorAnimado.ts"/>
class TelescopioAnimado extends ActorAnimado {
static _grilla = 'actor.telescopios.png'
movimientos = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
constructor() {
super(0, 0, {cantColumnas: 10});
//this.definirAnimacion("parado", [0], 1);
//this.definirAnimacion("mover", [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 6, 7, 8, 9, 8, 7, 6, 0], 12);

this.movimientos.forEach(nro =>
this.definirAnimacion("mover" + nro, [nro], 1));
this.cargarAnimacion("mover0");
}

mover() {
this.cargarAnimacion("mover" + this.siguienteNumero());
}

siguienteNumero() {
var sgte = parseInt(this.nombreAnimacionActual().slice(5)) + 1;
return sgte > 9 ? 0 : sgte;
}
}
Binary file added src/assets/actor.telescopios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/fondo.manic.oscuro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sombra5.telescopios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sombra7.telescopios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sombra9.telescopios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
110 changes: 110 additions & 0 deletions src/escenas/BuscandoLasEstrellas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/// <reference path = "EscenaActividad.ts" />
/// <reference path = "../actores/segundoCiclo/Manic/Manic.ts" />
/// <reference path = "../actores/segundoCiclo/Manic/TelescopioAnimado.ts" />
/// <reference path = "../actores/segundoCiclo/Chuy/Chuy.ts" />
/// <reference path = "../actores/segundoCiclo/Yvoty/Yvoty.ts" />
/// <reference path = "../comportamientos/SecuenciaAnimada.ts" />
/// <reference path = "../comportamientos/Interactuar.ts" />


class BuscandoLasEstrellas extends EscenaActividad {
automata;
telescopios = [];
amigos = [];

iniciar() {
this.fondo = new Fondo('fondo.manic.oscuro.png', 0, 0);
this.cuadricula = new Cuadricula(-50, -70, 1, 4,
{ alto: 180, ancho: 590 },
{ grilla: 'invisible.png', cantColumnas: 1 });
this.cuadricula.casilla(0, 1).cambiarImagen('sombra5.telescopios.png');
this.cuadricula.casilla(0, 2).cambiarImagen('sombra7.telescopios.png');
this.cuadricula.casilla(0, 3).cambiarImagen('sombra9.telescopios.png');
this.agregarTelescopios();
this.agregarAutomata();
this.agregarAmigos();
this.crearEstado();
}

agregarAutomata() {
this.automata = new Manic();
this.cuadricula.agregarActor(this.automata, 0, 1, false);
this.automata.y += 20;
this.automata.x -= 30;
this.automata.definirAnimacion("moverTelescopio", [28, 29, 30, 28], 3, false);

}

agregarTelescopios() {
this.telescopios.push(new TelescopioAnimado());
this.telescopios.push(new TelescopioAnimado());
this.telescopios.push(new TelescopioAnimado());
this.cuadricula.agregarActor(this.telescopios[0], 0, 1, false);
this.cuadricula.agregarActor(this.telescopios[1], 0, 2, false);
this.cuadricula.agregarActor(this.telescopios[2], 0, 3, false);
this.telescopios.forEach(t => { t.escala = 0.7; t.x += -3});
}

agregarAmigos() {
const posiciones = [ { x: 15, y: 10}, { x: 20, y: 30}, { x: 30, y: 50 }];
this.amigos.push(new Chuy());
this.amigos.push(new Yvoty());
this.amigos.push(new Capy());
this.amigos.forEach((a,i) => {
this.cuadricula.agregarActor(this.amigos[i], 0, 0, false);
a.x -= posiciones[i].x;
a.y -= posiciones[i].y;
});
}

private crearEstado() {
var builder = new BuilderStatePattern(this, 'nadieObserva');
builder.agregarEstadoAceptacion('todosObservando');
builder.agregarTransicion('nadieObserva', 'todosObservando', 'observarConAmigos');
this.estado = builder.estadoInicial();
}
}

class MoverTelescopio extends Interactuar {

sanitizarArgumentos() {
this.argumentos.etiqueta = "TelescopioAnimado";
this.argumentos.nombreAnimacion = "moverTelescopio";
super.sanitizarArgumentos();
}

protected alInteractuar(): void {
(this.interactuado() as TelescopioAnimado).mover();
}

}

class TodosObservando extends SecuenciaAnimada {
sanitizarArgumentos() {
pilas.escena_actual().automata.x -= 80;
pilas.escena_actual().automata.espejado = true;
this.argumentos.secuencia = [
new Decir({ receptor: pilas.escena_actual().automata, mensaje: "Vengan a observar conmigo!" }),
new MoverACasillaDerecha({ receptor: pilas.escena_actual().amigos[0] }),
new MoverACasillaDerecha({ receptor: pilas.escena_actual().amigos[0] }),
new MoverACasillaDerecha({ receptor: pilas.escena_actual().amigos[0] }),
new MoverACasillaDerecha({ receptor: pilas.escena_actual().amigos[1] }),
new MoverACasillaDerecha({ receptor: pilas.escena_actual().amigos[1] }),
new MoverACasillaDerecha({ receptor: pilas.escena_actual().amigos[2] }),
];
super.sanitizarArgumentos();
}

configurarVerificaciones() {
super.configurarVerificaciones();
this.agregarVerificacionTelescopio(0, 5, "primer");
this.agregarVerificacionTelescopio(1, 7, "segundo");
this.agregarVerificacionTelescopio(2, 9, "tercer");
}

agregarVerificacionTelescopio(i, veces, ordinal) {
this.verificacionesPre.push(
new Verificacion(() => pilas.escena_actual().telescopios[i].nombreAnimacionActual() === "mover" + veces,
"¡El " + ordinal + " telescopio debe moverse " + veces + " veces!"));
}
}
Loading

0 comments on commit 304aaf8

Please sign in to comment.