Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleciondolo authored May 15, 2024
1 parent b53fb87 commit 28f3c26
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Main.prototype = {

this.tileVelocity = -450;
this.rate = 1500;
this.rate2 = 2000;
score = 0;

this.tileWidth = this.game.cache.getImage('tile').width;
Expand Down Expand Up @@ -100,6 +101,7 @@ Main.prototype = {
},
addObstacles: function () {
var tilesNeeded = Math.floor( Math.random() * (5 - 0));

// var gap = Math.floor( Math.random() * (tilesNeeded - 0));
if (this.rate > 200) {
this.rate -= 10;
Expand All @@ -111,6 +113,23 @@ Main.prototype = {

this.addBox(this.game.world.width , this.game.world.height -
this.tileHeight - ((i + 1)* this.boxHeight ));


}
},
addBenefit: function () {
var tilesNeeded2 = Math.floor( Math.random() * (5 - 0));

// var gap = Math.floor( Math.random() * (tilesNeeded - 0));

if (this.rate2 > 200) {
this.rate2 -= 10;
this.tileVelocity = -(675000 / this.rate2);

}
for (var i = 0; i < tilesNeeded; i++) {


this.addCommesse(this.game.world.width , this.game.world.height -
this.tileHeight - ((i + 1)* this.boxHeight ));

Expand Down

0 comments on commit 28f3c26

Please sign in to comment.