Skip to content

Commit

Permalink
Add more balls
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisAraujo committed Jan 6, 2021
1 parent 6c14aaa commit f731c82
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bolinha.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Bola.prototype.click = function () {
if(!this.on){

if( (this.dep01 == null ) || (this.dep01.getOn())) {
this.x = 350 + this.x;
this.x = 110 + this.x;
this.on = true;
valor += this.val;

Expand All @@ -71,7 +71,7 @@ Bola.prototype.click = function () {
}else{

if( (this.dep02 == null ) || (!this.dep02.getOn())) {
this.x = this.x - 350;
this.x = this.x - 110;
this.on = false;
valor -= this.val;

Expand Down
54 changes: 46 additions & 8 deletions mygame.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,22 @@ function setJogo(){
b03 = new Bola( [anim, anim2], 150, 100, "button",1 );
b04 = new Bola( [anim, anim2], 200, 100, "button",1 );
b05 = new Bola( [anim, anim2], 250, 100, "button",1 );

b06 = new Bola( [anim, anim2], 300, 100, "button",1 );
b07 = new Bola( [anim, anim2], 350, 100, "button",1 );
b08 = new Bola( [anim, anim2], 400, 100, "button",1 );
b09 = new Bola( [anim, anim2], 450, 100, "button",1 );
b10 = new Bola( [anim, anim2], 500, 100, "button",1 );

b01.setDependence(b02, null);
b02.setDependence(b03, b01);
b03.setDependence(b04, b02);
b04.setDependence(b05, b03);
b05.setDependence(null, b04);
b05.setDependence(b06, b04);
b06.setDependence(b07, b05);
b07.setDependence(b08, b06);
b08.setDependence(b09, b07);
b09.setDependence(b10, b08);
b10.setDependence(null, b09);

anim3 = new Animation( ["bola_azul"]);
anim4 = new Animation( ["bola_azul_on"]);
Expand All @@ -78,13 +87,22 @@ function setJogo(){
b13 = new Bola([anim3, anim4], 150, 200, "button", 10 );
b14 = new Bola([anim3, anim4], 200, 200, "button", 10 );
b15 = new Bola([anim3, anim4], 250, 200, "button", 10 );

b16 = new Bola([anim3, anim4], 300, 200, "button", 10 );
b17 = new Bola([anim3, anim4], 350, 200, "button", 10 );
b18 = new Bola([anim3, anim4], 400, 200, "button", 10 );
b19 = new Bola([anim3, anim4], 450, 200, "button", 10 );
b20 = new Bola([anim3, anim4], 500, 200, "button", 10 );

b11.setDependence(b12, null);
b12.setDependence(b13, b11);
b13.setDependence(b14, b12);
b14.setDependence(b15, b13);
b15.setDependence(null, b14);
b15.setDependence(b16, b14);
b16.setDependence(b17, b15);
b17.setDependence(b18, b16);
b18.setDependence(b19, b17);
b19.setDependence(b20, b18);
b20.setDependence(null, b19);

anim5 = new Animation( ["bola_laranja"]);
anim6 = new Animation( ["bola_laranja_on"]);
Expand All @@ -95,12 +113,24 @@ function setJogo(){
b23 = new Bola([anim5, anim6], 150, 300, "button", 100 );
b24 = new Bola([anim5, anim6], 200, 300, "button", 100 );
b25 = new Bola([anim5, anim6], 250, 300, "button", 100 );
b26 = new Bola([anim5, anim6], 300, 300, "button", 100 );
b27 = new Bola([anim5, anim6], 350, 300, "button", 100 );
b28 = new Bola([anim5, anim6], 400, 300, "button", 100 );
b29 = new Bola([anim5, anim6], 450, 300, "button", 100 );
b30 = new Bola([anim5, anim6], 500, 300, "button", 100 );


b21.setDependence(b22, null);
b22.setDependence(b23, b21);
b23.setDependence(b24, b22);
b24.setDependence(b25, b23);
b25.setDependence(null, b24);
b25.setDependence(b26, b24);
b26.setDependence(b27, b25);
b27.setDependence(b28, b26);
b28.setDependence(b29, b27);
b29.setDependence(b30, b28);
b30.setDependence(null, b29);


anim7 = new Animation( ["bola_vermelha"]);
anim8 = new Animation( ["bola_vermelha_on"]);
Expand All @@ -111,14 +141,22 @@ function setJogo(){
b33 = new Bola([anim7, anim8], 150, 400, "button", 1000 );
b34 = new Bola([anim7, anim8], 200, 400, "button", 1000 );
b35 = new Bola([anim7, anim8], 250, 400, "button", 1000 );
b36 = new Bola([anim7, anim8], 300, 400, "button", 1000 );
b37 = new Bola([anim7, anim8], 350, 400, "button", 1000 );
b38 = new Bola([anim7, anim8], 400, 400, "button", 1000 );
b39 = new Bola([anim7, anim8], 450, 400, "button", 1000 );
b40 = new Bola([anim7, anim8], 500, 400, "button", 1000 );

b31.setDependence(b32, null);
b32.setDependence(b33, b31);
b33.setDependence(b34, b32);
b34.setDependence(b35, b33);
b35.setDependence(null, b34);

//arrayB = [b01, b02, b03, b04, b05,b11, b12, b13, b14, b15,b21, b22, b23, b24, b25,b31, b32, b33, b34, b35];
b35.setDependence(b36, b34);
b36.setDependence(b37, b35);
b37.setDependence(b38, b36);
b38.setDependence(b39, b37);
b39.setDependence(b40, b38);
b40.setDependence(null, b39);

valor = 0;

Expand Down

0 comments on commit f731c82

Please sign in to comment.