Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addTile: function(x, y){
- var tile = this.platforms.getFirstDead();
- tile.reset(x, y);
- tile.body.velocity.y = 150;
- tile.body.immovable = true;
- tile.checkWorldBounds = true;
- tile.outOfBoundsKill = true;
- },
- addPlatform: function(y){
- if(typeof(y) == "undefined"){
- y = -this.tileHeight;
- this.incrementScore();
- }
- var tilesNeeded = Math.ceil(this.game.world.width / this.tileWidth);
- var hole = Math.floor(Math.random() * (tilesNeeded - 3)) + 1;
- for (var i = 0; i < tilesNeeded; i++){
- if (i != hole && i != hole + 1){
- this.addTile(i * this.tileWidth, y);
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement