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 c794a33 commit 158b265
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,17 @@ Main.prototype = {
tile.outOfBoundsKill = true;
// tile.body.friction.x = 1000;
},
addCommesse: function (x, y) {

var tile = this.commesse.getFirstDead();

tile.reset(x, y);
tile.body.velocity.x = this.tileVelocity;
tile.body.immovable = true;
tile.checkWorldBounds = true;
tile.outOfBoundsKill = true;
// tile.body.friction.x = 1000;
},
addObstacles: function () {
var tilesNeeded = Math.floor( Math.random() * (5 - 0));
// var gap = Math.floor( Math.random() * (tilesNeeded - 0));
Expand All @@ -101,6 +111,8 @@ Main.prototype = {

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

}
},
Expand Down

0 comments on commit 158b265

Please sign in to comment.