Skip to content

Commit

Permalink
Merge branch 'master' into superMaraton
Browse files Browse the repository at this point in the history
  • Loading branch information
danielferro69 authored Oct 20, 2023
2 parents 0ba19c0 + 7050d1d commit c8acbb1
Show file tree
Hide file tree
Showing 27 changed files with 258 additions and 189 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.9",
"version": "1.4.12",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
4 changes: 4 additions & 0 deletions src/actores/Casilla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ class Casilla extends ActorAnimado {
return this.actores.some( actor => actor.tiene_etiqueta(unaEtq))
}

tieneMasDeUnActor(){
return this.actores.length > 1
}

actoresConEtiqueta(unaEtq) {
return this.actores.filter(actor => actor.tiene_etiqueta(unaEtq));
}
Expand Down
3 changes: 2 additions & 1 deletion src/actores/segundoCiclo/Chuy/Chuy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class Chuy extends ActorAnimado {
this.definirAnimacion("obstaculo", [0, 1, 1, 2, 2, 3, 3, 4, 4, 4], 12)
this.definirAnimacion("error", [101, 101, 101, 102, 102, 103, 103, 104, 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105], 12)
this.definirAnimacion("recoger", [97, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 97], 12);
this.definirAnimacion("revolearPulpito", [21, 22, 22, 22, 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], 10);
this.definirAnimacion("revolearPulpito", [ 97, 97, 97, 109, 109, 109, 108, 108, 108, 107, 107, 107, 106, 106, 106, 107, 107, 107, 108, 108, 108, 109, 109, 109,
109, 109, 109, 108, 108, 108, 107, 107, 107, 106, 106, 106, 107, 107, 107, 108, 108, 108, 109, 109, 109, 97, 97, 97], 12);
this.definirAnimacion("usarPaleta", [51, 52, 53, 54, 55, 56, 57, 58, 57, 56, 55, 56, 57, 58, 57, 56, 55, 56, 57, 58, 57, 56, 55, 56, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67], 12);
this.definirAnimacion("usarPaletaUnaVez", [51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67], 6);
this.definirAnimacion("rebotarPelota", [87, 88, 89, 90, 91, 92, 93, 92, 91, 90, 94, 95, 90, 91, 92, 93, 91, 94, 91, 93, 90, 94, 96, 87, 87, 87, 87], 12);
Expand Down
13 changes: 5 additions & 8 deletions src/actores/segundoCiclo/Manic/Manic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ class Manic extends ActorAnimado {
constructor() {
super(0,0,{cantColumnas: 10, cantFilas: 9});
this.definirAnimacion("parado",
new Cuadros(0).repetirVeces(16)
new Cuadros(32).repetirVeces(18)
.concat([33, 34, 34, 32, 32, 32, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32])
.concat(new Cuadros(32).repetirVeces(18))
.concat([33, 34, 34, 32, 32, 32, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32])
.concat([32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 34, 34, 32, 32, 32, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32])
.concat(new Cuadros(0).repetirVeces(30))
.concat([32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 34, 34, 32, 32, 32, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32])
.concat(new Cuadros(0).repetirVeces(30))
.concat([32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 34, 34, 32, 32, 32, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 44, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32])
.concat(new Cuadros(0).repetirVeces(16))
.concat([32])
.concat(new Cuadros(0).repetirVeces(5)),
.concat([32]),
20, true);
this.definirAnimacion("correr", [0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 7], 20);
this.definirAnimacion("correrChocando", [0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 7], 12)
Expand Down
20 changes: 20 additions & 0 deletions src/actores/segundoCiclo/MetaFinal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/// <reference path="../ActorAnimado.ts"/>

class MetaFinal extends ActorAnimado {

static imagenesPara(actor) : string[] {
return [`marcador-${actor}.png`];
}

constructor(actor: string) {
super(0, 0, { grilla: `marcador-${actor}.png`, cantColumnas: 1, cantFilas: 1 });
}

enviarAtras() {
this.setZ(Math.min(this.getZ() + 1))
}

ajustarSegunCuadricula(alto){
this.setY(this.getY() + alto / 2)
}
}
Binary file modified src/assets/actor.chuy.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/marcador-capy.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/marcador-chuy.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/marcador-duba.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/marcador-lita.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/marcador-manic.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/marcador-yvoty.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 modified src/assets/pelotaAnimada.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/comportamientos/PingPongAnimado.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ frase definida por la escena

class PingPongAnimado extends Decir {
preAnimacion(): void {
super.preAnimacion();
this.receptor.escena.antesDeRebotar();
this.argumentos.mensaje = this.receptor.escena.getFraseAlRebotar()
super.preAnimacion();
}

postAnimacion(){
Expand Down
24 changes: 23 additions & 1 deletion src/escenas/ChuyHaciendoJueguito.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,29 @@ class ChuyHaciendoJueguito extends EscenaActividad {
builder.agregarTransicion('levantarPelota','jugarConElPie','rebotarPiePulpito');
builder.agregarTransicion('tirarAlAire','resuelto','rebotarPiePulpito');
builder.agregarTransicion('jugarConElPie','resuelto','revolearPulpito');
builder.agregarTransicion('resuelto','fin','volver');
builder.agregarTransicion('resuelto','fin','retroceder');

builder.agregarError('inicial', 'recoger', 'Primero hay que entrar en calor');
builder.agregarError('inicial', 'revolearPulpito', 'Primero hay que entrar en calor y agarrar la pelota');
builder.agregarError('inicial', 'rebotarPiePulpito', 'Primero hay que entrar en calor y agarrar la pelota');
builder.agregarError('inicial', 'retroceder', 'Primero hay que avanzar y entrar en calor');

builder.agregarError('posCorrecta', 'recoger', 'Primero hay que entrar en calor');
builder.agregarError('posCorrecta', 'revolearPulpito', 'Primero hay que entrar en calor y agarrar la pelota');
builder.agregarError('posCorrecta', 'rebotarPiePulpito', 'Primero hay que entrar en calor y agarrar la pelota');

builder.agregarError('calentar1', 'revolearPulpito', 'Primero hay que entrar en calor y agarrar la pelota');
builder.agregarError('calentar1', 'rebotarPiePulpito', 'Primero hay que entrar en calor y agarrar la pelota');
builder.agregarError('calentar1', 'retroceder', 'Primero hay que avanzar, entrar en calor y agarrar la pelota');

builder.agregarError('calentar2', 'revolearPulpito', 'Primero hay que entrar en calor y agarrar la pelota');
builder.agregarError('calentar2', 'rebotarPiePulpito', 'Primero hay que entrar en calor y agarrar la pelota');

builder.agregarError('enCalor', 'revolearPulpito', 'Primero hay que agarrar la pelota');
builder.agregarError('enCalor', 'rebotarPiePulpito', 'Primero hay que agarrar la pelota');
builder.agregarError('enCalor', 'retroceder', 'Primero hay que agarrar la pelota');

builder.agregarError('levantarPelota', 'retroceder', 'Primero hay que jugar con la pelota');

this.estado = builder.estadoInicial();
}
Expand Down
14 changes: 14 additions & 0 deletions src/escenas/EscenaActividad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class EscenaActividad extends Base {
automata : ActorAnimado;
cuadricula : Cuadricula;
fondo;
xFinal: number;
yFinal: number;

/**
* Devuelve todos los nombres de archivo de imagen necesarios para
Expand Down Expand Up @@ -99,6 +101,18 @@ class EscenaActividad extends Base {
return this.obtenerActoresConEtiqueta(actor).every(o => o.nombreAnimacionActual() == estado);
}

estaEnPosicionFinalSiLaTiene(): boolean {
return !this.tienePosicionFinal() || this.automataEnPosicionFinal()
}

tienePosicionFinal(): boolean {
return this.xFinal !== undefined
}

automataEnPosicionFinal(): boolean {
return this.automata.casillaActual().sos(this.yFinal, this.xFinal);
}

/**
* Computa un multiplicador que crece según la cantidad de filas y columnas de la cuadrícula.
* El multiplicador es 1 si la cuadrícula es de 1x1, y crece acotado por maxRatio.
Expand Down
8 changes: 6 additions & 2 deletions src/escenas/NoMeCansoDeRebotar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@
this.paleta.escala = 0;
}

fraseAlRebotar(){
this.rebotesFaltantes--;
getFraseAlRebotar(): string {
if (this.rebotesFaltantes > 0) return " Faltan " + this.rebotesFaltantes + " rebotes";
if (this.rebotesFaltantes == 0) return " ¡Ya hice los rebotes necesarios!";
throw new ActividadError(" ¡Uy! Hice muchos rebotes... ¡Me pasé!");
}

fraseAlRebotar(){
this.rebotesFaltantes--;
return this.getFraseAlRebotar();
}

estaResueltoElProblema() {
return this.rebotesFaltantes == 0;
}
Expand Down
4 changes: 4 additions & 0 deletions src/escenas/libroPrimaria/CustomScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class CustomScene extends EscenaDesdeMapa {
this.initDesdeUnaOVariasDescripciones(options.grid.spec, options.grid.specOptions);
}

static nombreAutomata(): string {
return 'custom'
}

obtenerAutomata(): ActorAnimado {
return this.automata
}
Expand Down
19 changes: 5 additions & 14 deletions src/escenas/libroPrimaria/EscenaCapy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class EscenaCapy extends EscenaDesdeMapa {
return 'fondo.capy.png';
}

static imagenesAdicionales(): string[] {
return Casilla.imagenesPara('capy').concat(Obstaculo.imagenesPara('capy'));
static nombreAutomata(): string {
return 'capy'
}

constructor(especificacion: Spec, opciones?: opcionesMapaAleatorio) {
constructor(especificacion: Spec, opciones?: opcionesMapaAleatorio, posFinal?: [number, number]) {
super();
this.initDesdeUnaOVariasDescripciones(especificacion, opciones);
this.initDesdeUnaOVariasDescripciones(especificacion, opciones, posFinal);
}

ajustarGraficos() {
Expand Down Expand Up @@ -57,10 +57,6 @@ class EscenaCapy extends EscenaDesdeMapa {
return new Obstaculo(archivosObstaculos, (fila + 1) + (fila + 1) * (columna + 1));
}

todosLosActoresCumplen(actor, estado) {
return this.obtenerActoresConEtiqueta(actor).every(o => o.nombreAnimacionActual() == estado);
}

tachosLlenos(): boolean {
return this.todosLosActoresCumplen("Tacho", "lleno")
}
Expand All @@ -77,13 +73,8 @@ class EscenaCapy extends EscenaDesdeMapa {
return this.recogidos(actor) || this.noHay(actor)
}


noHay(actor): boolean {
return this.contarActoresConEtiqueta(actor) == 0
}

estaResueltoElProblema(): boolean {
return this.tachoResuelto() && this.recoleccionResuelta("Lata") && this.recoleccionResuelta("Papel")
return super.estaResueltoElProblema() && this.tachoResuelto() && this.recoleccionResuelta("Lata") && this.recoleccionResuelta("Papel")
}

archivoFondo() {
Expand Down
15 changes: 5 additions & 10 deletions src/escenas/libroPrimaria/EscenaChuy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@ class EscenaChuy extends EscenaDesdeMapa {
return 'fondo.chuy.png';
}

static imagenesAdicionales(): string[] {
return Casilla.imagenesPara('chuy').concat(Obstaculo.imagenesPara('chuy'));
static nombreAutomata(): string {
return 'chuy'
}

constructor(especificacion: Spec, opciones?: opcionesMapaAleatorio, posFinal?: [number, number]) {
super();
this.initDesdeUnaOVariasDescripciones(especificacion, opciones);

if (posFinal) {
this.xFinal = posFinal[0];
this.yFinal = posFinal[1];
}
this.initDesdeUnaOVariasDescripciones(especificacion, opciones, posFinal);
}

ajustarGraficos() {
Expand All @@ -44,7 +39,7 @@ class EscenaChuy extends EscenaDesdeMapa {

this.obtenerActoresConEtiqueta("PelotaAnimada").forEach(actor => {
actor.aprender(Flotar, { Desvio: 4 });
actor.escala *= this.escalaSegunCuadricula(0.5);
actor.escala *= this.escalaSegunCuadricula(0.1);
});

this.obtenerActoresConEtiqueta("PingPong").forEach(actor => {
Expand Down Expand Up @@ -83,7 +78,7 @@ class EscenaChuy extends EscenaDesdeMapa {
}

estaEnPosicionFinalSiLaTiene(): boolean {
return this.xFinal === undefined || this.automata.casillaActual().sos(this.yFinal, this.xFinal) || this.automata.alFinalDelCamino();
return super.estaEnPosicionFinalSiLaTiene() || this.automata.alFinalDelCamino();
}

noHayPelotas(): boolean {
Expand Down
Loading

0 comments on commit c8acbb1

Please sign in to comment.