Skip to content

Commit

Permalink
Merge tag '1.4.17' into Paleteando
Browse files Browse the repository at this point in the history
  • Loading branch information
danielferro69 committed Oct 27, 2023
2 parents 8166cf0 + d5e9897 commit eb66470
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 53 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.15",
"version": "1.4.17",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
1 change: 0 additions & 1 deletion src/actores/segundoCiclo/Capy/CapySolo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference path="../../ActorAnimado.ts"/>
/// <reference path="../../../comportamientos/ComportamientoAnimado.ts"/>e

class CapySolo extends ActorAnimado {
static _grilla = 'actor.capySolo.png'
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 @@ -28,5 +28,6 @@ class Chuy extends ActorAnimado {
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);
this.definirAnimacion("patear", [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)
this.definirAnimacion("rebotarPulpito", [77, 78, 79, 80, 81, 82, 83, 82, 81, 80, 84, 85, 80, 81, 82, 83, 81, 84, 81, 83, 80, 84, 86, 77, 77, 77, 77], 12);
}
this.definirAnimacion("surfear", [68, 69, 70, 71, 72, 73, 74, 75, 76], 12);
}
}
1 change: 1 addition & 0 deletions src/actores/segundoCiclo/Chuy/Pelotas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Pulpito extends ActorAnimado {

constructor() {
super(0, 0, { cantColumnas: 2 });
this.definirAnimacion("correr", [0], 12)
this.definirAnimacion("desaparecer", [1], 12);
}
}
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 @@ -21,5 +21,6 @@ class Manic extends ActorAnimado {
this.definirAnimacion("recoger", [28, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 28], 12);
this.definirAnimacion("usarCatalejo", [54, 55, 56, 57, 58, 59, 60, 61, 61, 62, 62, 62, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 77, 78, 79, 80, 81, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82], 20);
this.definirAnimacion("dibujar", [0, 1, 2, 3, 4, 5, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27], 20);
this.definirAnimacion("surfear", [0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 6, 7, 6, 5, 6, 7, 7], 20);
}
}
1 change: 1 addition & 0 deletions src/actores/segundoCiclo/Manic/Telescopio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Telescopio extends ActorAnimado {
super(0, 0, {cantColumnas: 2});
this.definirAnimacion("roto", [1], 1);
this.definirAnimacion("arreglado", [0], 1);
this.definirAnimacion("recoger", [0], 1)

if(arreglado)
this.cargarAnimacion("arreglado")
Expand Down
1 change: 1 addition & 0 deletions src/actores/segundoCiclo/Yvoty/Yvoty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ class Yvoty extends ActorAnimado {
this.definirAnimacion("usarCelu", [38, 38, 38, 39, 39, 40, 40, 40, 41, 42, 43, 41, 43, 42, 42, 42, 44, 45, 46, 47, 46, 42, 42, 42, 45, 46, 46, 46, 45, 44, 48, 48, 48, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 38, 38, 38, 38, 38, 38, 38], 20);
this.definirAnimacion("sacarFoto", [38, 38, 38, 39, 39, 40, 40, 40, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 40, 40, 40, 40], 20);
this.definirAnimacion("escribir", [16, 16, 17, 17, 18, 18, 18, 19, 19, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18], 20);
this.definirAnimacion("surfear", [52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71], 20)
}
}
4 changes: 2 additions & 2 deletions src/comportamientos/Escapar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Escapar extends MovimientoAnimado {
}

preAnimacion(){
this.argumentos.direccion = new Direct(1, 5);
this.argumentos.direccion = this.argumentos.direccion || new Direct(1,5)
this.argumentos.distancia = 600;
this.argumentos.velocidad = 8;
this.argumentos.cantPasos = 40;
Expand Down Expand Up @@ -42,4 +42,4 @@ class Escapar extends MovimientoAnimado {

return (noTieneQueEscaparConNingunActor || colisionaConElActorParaEscapar);
}
}
}
44 changes: 0 additions & 44 deletions src/comportamientos/Irse.ts

This file was deleted.

6 changes: 5 additions & 1 deletion src/comportamientos/Sostener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Sostener extends Interactuar {
var objetoAgarrado: any = interactuado.clonar()
objetoAgarrado.escala = interactuado.escala
objetoAgarrado.y = this.receptor.y
objetoAgarrado.x = this.receptor.subactores[0].derecha - (this.receptor.subactores[0].ancho / 4)
objetoAgarrado.x = this.posicionHorizontalDeProximoSubactor()
this.receptor.agregarSubactor(objetoAgarrado)
objetoAgarrado.cargarAnimacion("correr") // porque tiene que cargar la misma imagen que va a usar al moverse

Expand All @@ -29,6 +29,10 @@ class Sostener extends Interactuar {

}

posicionHorizontalDeProximoSubactor(): number {
return this.receptor.subactores[0].derecha - (this.receptor.subactores[0].ancho / 4)
}

configurarVerificaciones() {
super.configurarVerificaciones()
this.verificacionesPre.push(new Verificacion(() => this.puedoSostener(), "No puedo sostener dos cosas a la vez..."))
Expand Down
236 changes: 236 additions & 0 deletions src/escenas/libroPrimaria/EscapeEnYacare.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
/// <reference path = "../libroPrimaria/EscenaDesdeMapa.ts" />

class ActorConEntregable extends ActorCompuesto{
acomodarseEnCapy(capy: CapyConSeguidores): void{
const entregable = this.subactores.pop()
//capy.agregarSubactor(entregable)
capy.posicionarEnMano(entregable)
}
}

class TelescopioEntregable extends Telescopio{
acomodarseEnCapy(capy: CapyConSeguidores): void{
capy.posicionarEnMano(this)
}
}

class ManicConPelota extends ActorConEntregable{
constructor() {

const manic = new Manic()
manic.escala *= 0.06;

super(0,0, { subactores: [manic]});

const pelota = new Pulpito()
pelota.escala *= 0.02;
pelota.x = manic.derecha + 10
this.agregarSubactor(pelota)


}
}

class ChuyConCargador extends ActorConEntregable{
constructor() {
const chuy = new Chuy()
chuy.escala *= 0.05;

super(0,0, { subactores: [chuy]});

const cargador = new Cargador()
cargador.escala *= 0.02;
cargador.x = chuy.derecha + 10

this.agregarSubactor(cargador)
}
}

class YvotySinEntregable extends ActorCompuesto {

constructor() {
const yvoty = new Yvoty()
yvoty.escala *= 0.05;
super(0,0, { subactores: [yvoty]});
}

acomodarseEnCapy(capy: CapyConSeguidores): void{

}
}

class CapyConSeguidores extends ActorCompuesto{

entregableEnMano: ActorAnimado

constructor(){
const capy = new Capy()
capy.escala *= 0.06

super(0,0, { subactores: [capy], puedoSostenerMasDeUno: true});
}

entregarSiPuede(){
if (this.entregableEnMano){
this.entregableEnMano.eliminar()
this.subactores = this.subactores.filter(actor => actor !== this.entregableEnMano)
this.entregableEnMano = null
}
}

acomodarEntregable(){
const actorConEntregable = this.subactores[this.subactores.length - 1]
actorConEntregable.acomodarseEnCapy(this)
}

posicionarEnMano(entregable: ActorAnimado){
this.entregableEnMano = entregable
}

entregar(): void{
this.entregableEnMano.eliminar()
}

espejarSeguidor(seguidor, posicion){
const x = posicion * 50 - 30

if (!this.espejado){
seguidor.x = this.subactores[0].izquierda - x
}

else {
seguidor.x = this.subactores[0].derecha + x
}
}

espejarEntregableEnMano(){
if (!this.espejado){
this.entregableEnMano.x = this.subactores[0].derecha
}
else{
this.entregableEnMano.x = this.subactores[0].izquierda
}
}

tieneAlgoEnLaMano(): boolean{
return false
}

actualizar(): void{
super.actualizar()
this.subactores.forEach((seguidor, indice) => {
if(seguidor !== this.entregableEnMano && indice !== 0){
this.espejarSeguidor(seguidor,indice)
}
})
if(this.entregableEnMano){
this.espejarEntregableEnMano()
}
}
}

class AgregarASeguidores extends Sostener {

alInteractuar(): void{
super.alInteractuar()
this.receptor.entregarSiPuede()
this.receptor.acomodarEntregable()
}

posicionHorizontalDeProximoSubactor(): number {
return this.receptor.subactores[0].izquierda + 50 * this.receptor.subactores.length
}
}

class IrseEnYacare extends Escapar {
iniciar(receptor){
super.iniciar(receptor)
this.argumentos.nombreAnimacion = "surfear"
this.argumentos.direccion = new Direct(1)
this.argumentos.escaparCon = "yacare"
this.argumentos.idTransicion = "irse"
}

preAnimacion(){
super.preAnimacion()
this.receptor.eliminarUltimoSubactor()
}
}

class EscapeEnYacare extends EscenaActividad {

automata: CapySolo;
telescopio: Telescopio
manic: Manic
chuy: Chuy
yvoty: Yvoty
yacare: Yacare

iniciar() {
this.fondo = new Fondo('fondo.capy.png', 0, 0);

this.cuadricula = new Cuadricula(0,0,4,5,
EscenaCapy.opsCuadricula(),
EscenaCapy.opsCasilla());

this.telescopio = new TelescopioEntregable();
this.cuadricula.agregarActor(this.telescopio, 1, 4)

this.manic = new ManicConPelota()
this.cuadricula.agregarActor(this.manic, 0, 0);

this.chuy = new ChuyConCargador()
this.cuadricula.agregarActor(this.chuy,2,2);

this.yvoty = new YvotySinEntregable();
this.cuadricula.agregarActor(this.yvoty, 1, 2);

this.automata = new CapyConSeguidores()
this.cuadricula.agregarActor(this.automata, 3, 0);

this.yacare = new Yacare();
this.cuadricula.agregarActor(this.yacare, 3, 1);
this.yacare.y -= 10;
this.yacare.escala *= 1.2
this.yacare.aprender(Flotar, { Desvio: 2 });

this.construirFSM();
}



private construirFSM(){
const builder= new BuilderStatePattern(this, 'inicial');
builder.agregarEstado('telescopioEnMano');
builder.agregarEstado('pelotaEnMano');
builder.agregarEstado('cargadorEnMano');
builder.agregarEstado('todosEntregados');
builder.agregarEstadoAceptacion('montandoYacare');

builder.agregarTransicion('inicial','telescopioEnMano','agarrarTelescopio');
builder.agregarTransicion('telescopioEnMano','pelotaEnMano','entregarTelescopio');
builder.agregarTransicion('pelotaEnMano','cargadorEnMano','entregarPelota');
builder.agregarTransicion('cargadorEnMano','todosEntregados','entregarCargador');
builder.agregarTransicion('todosEntregados','montandoYacare','irse');

const estadosEnOrden = ['inicial','telescopioEnMano','pelotaEnMano','cargadorEnMano','montandoYacare']

for (let i = 0; i < estadosEnOrden.length; i++) {
if(estadosEnOrden[i]!='telescopioEnMano'){
builder.agregarError(estadosEnOrden[i],'entregarTelescopio', 'Mañic necesita su telescopio.');
}
if(estadosEnOrden[i]!='pelotaEnMano'){
builder.agregarError(estadosEnOrden[i],'entregarPelota','Chuy necesita su pelota.');
}
if(estadosEnOrden[i]!='cargadorEnMano'){
builder.agregarError(estadosEnOrden[i],'entregarCargador','Yvoty necesita su cargador.');
}
if(estadosEnOrden[i]!='todosEntregados'){
builder.agregarError(estadosEnOrden[i],'montarYacare','Para montar el yacare todos deben haber recuperado sus cosas.');
}
}

this.estado=builder.estadoInicial();
}

}
4 changes: 2 additions & 2 deletions src/escenas/libroPrimaria/EscenaCapy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ class EscenaCapy extends EscenaDesdeMapa {
cuadriculaY() {
return -20;
}
opsCuadricula() {
static opsCuadricula() {
return { ancho: 400, alto: 380 };
}
opsCasilla() {
static opsCasilla() {
return {
grilla: 'casillas.capy.png',
cantFilas: 1,
Expand Down

0 comments on commit eb66470

Please sign in to comment.