Skip to content

Commit

Permalink
celular + cargador
Browse files Browse the repository at this point in the history
  • Loading branch information
dlopezalvas committed May 11, 2023
1 parent 2929e0b commit 642f0ed
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
18 changes: 18 additions & 0 deletions src/actores/segundoCiclo/Yvoty/Celular.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference path="../../ActorAnimado.ts"/>
class Celular extends ActorAnimado {
static _grilla = 'actor.celular.png'

constructor() {
super(0, 0, {cantColumnas: 2});
this.definirAnimacion("cargado", [1], 1);
this.definirAnimacion("descargado", [0], 1);
}
}

class Cargador extends ActorAnimado {
static _grilla = 'actor.cargador.png'

constructor() {
super(0, 0, { cantColumnas:1, cantFilas: 1});
}
}
2 changes: 1 addition & 1 deletion src/actores/segundoCiclo/Yvoty/Yvoty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Yvoty extends ActorAnimado {
this.definirAnimacion("chocar", [128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175], 12)
this.definirAnimacion("error", [176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223], 12)
this.definirAnimacion("correr", [285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304], 12)
this.definirAnimacion("celular", [224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284]
this.definirAnimacion("usarCelu", [224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284]
, 12)
this.definirAnimacion("compu", [103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127], 12)
this.definirAnimacion("sacarFoto", [224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 97, 98]
Expand Down
32 changes: 32 additions & 0 deletions src/comportamientos/CargarCelular.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// <reference path = "../../node_modules/pilasweb/dist/pilasweb.d.ts"/>
/// <reference path = "Encender.ts" />

class CargarCelular extends Encender {

public nombreAnimacion(): String {
return "usarCelu"
}

public nombreProximaAnimacion(): string {
return "cargado"
}

configurarVerificaciones() {
super.configurarVerificaciones()

const escena = pilas.escena_actual()

this.verificacionesPre.push(new Verificacion(() => escena.noHayCargadores(),
'¡Todavía no recogí el cargador!'))

}

postAnimacion() {
super.postAnimacion()
if (pilas.escena_actual().celularesCargados()) {
pilas.escena_actual().estado = new Estado(() =>
true
)
}
}
}
8 changes: 6 additions & 2 deletions src/escenas/libroPrimaria/EscenaYvoty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class EscenaYvoty extends EscenaDesdeMapa {
this.automata.escala *= this.escalaSegunCuadricula(1.8);
this.automata.setY(this.automata.getY() + this.automata.getAlto() / 8);

this.obtenerActoresConEtiquetas(["Celular", "Luciernaga", "Cargador"]).forEach(actor => {
this.obtenerActoresConEtiquetas(["Celular", "Luciernaga", "Cargador", "Mariposa"]).forEach(actor => {
actor.aprender(Flotar, { Desvio: 5 });
actor.escala *= this.escalaSegunCuadricula(1.2) * 0.85;
});
Expand Down Expand Up @@ -66,7 +66,11 @@ class EscenaYvoty extends EscenaDesdeMapa {
}

celularesCargados(): boolean {
return this.todosLosActoresCumplen("Celular", "cargado") && this.contarActoresConEtiqueta("Cargador") == 0
return this.todosLosActoresCumplen("Celular", "cargado") && this.noHayCargadores()
}

noHayCargadores(): boolean {
return this.contarActoresConEtiqueta("Cargador") == 0
}

noHayMariposas(): boolean{
Expand Down

0 comments on commit 642f0ed

Please sign in to comment.