Skip to content

Commit

Permalink
Merge pull request #60 from Program-AR/Paleteando
Browse files Browse the repository at this point in the history
Paleteando con parametros
  • Loading branch information
danielferro69 authored Nov 7, 2023
2 parents 939756e + a6f7581 commit 1c8a2e5
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 2 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.17",
"version": "1.4.18",
"description": "Exercises for Pilas Bloques",
"homepage": "http://pilasbloques.program.ar",
"author": {
Expand Down
Binary file added src/assets/casilla.chuy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions src/escenas/PaleteandoConParametros.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/// <reference path = "EscenaActividad.ts" />
/// <reference path = "../actores/ScoutAnimado.ts" />
/// <reference path = "../actores/Cuadricula.ts" />
/// <reference path = "../actores/CompuAnimada.ts" />


class PaleteandoConParametros extends EscenaActividad {
cuadricula;
cantidadFilas;
cantidadColumnas;

iniciar() {
this.cantidadFilas = 5;
this.cantidadColumnas = 5;

let matriz = [
['T','T','T','T','T'],
['T','F','F','F','T'],
['T','F','F','F','T'],
['T','F','F','F','T'],
['T','T','T','T','T']
];


this.cuadricula = new CuadriculaEsparsa(0, 0,
{ separacionEntreCasillas: 5, ancho: 360, alto: 360},
{grilla: 'casilla.chuy.png'}, matriz)

this.fondo = new Fondo('fondo.chuy.png', 0, 0);

this.agregarPelotasDePingPong();

this.automata = new Chuy();
this.cuadricula.agregarActor(this.automata, 0, 0);
this.automata.escala *= 3;
this.automata.y += 50;
}

private agregarPelotasDePingPong() {

for (var i=1; i<this.cantidadColumnas-1; i++){
if (Math.random() < .5) {
this.agregarPelotaDePingPong(0, i);
//filaSuperior
}

if (Math.random() < .5) {
this.agregarPelotaDePingPong(this.cantidadFilas-1, i);
}
//filaInferior
}

for (var j=1; j<this.cantidadFilas-1; j++){
if (Math.random() < .5) {
this.agregarPelotaDePingPong(j, 0);
}

if (Math.random() < .5) {
this.agregarPelotaDePingPong(j, this.cantidadColumnas-1);
}
}
}

private agregarPelotaDePingPong(fila, columna) {
let pelota = new PingPong();
this.cuadricula.agregarActor(pelota, fila, columna);
pelota.aprender(Flotar, { Desvio: 2 });
pelota.escala *= 0.3;
}

estaResueltoElProblema() {
return pilas.escena_actual().noHay("PingPong");
}

}

0 comments on commit 1c8a2e5

Please sign in to comment.