var platformHeight = 32;
var prevPlatYPos = ( ( windowH / 16 ) * 3 );
var minPlatformYDist = ( windowH / 16 );
var maxPlatformYDist = ( ( windowH / 24 ) * 3 );
var platformCeilingOffset = ( windowH * 0.05 ); //this is the distance between the height of the game and the tallest platform
var platformFloorOffset = ( windowH * 0.12 ); //this is the distance between the bottom of the game and the lowest platform
var biasTowardsBottomMultiplier = 3;
var biasTowardsTopMultiplier = 15;
var platformWidth = 200;

function initializePlatformGroup() {
  platformsGroup = game.add.group();
  platformsGroup.enableBody = true;
  game.physics.arcade.enable(platformsGroup);
}

function createPlatform() {
  // visual of platYPos is generated
  // 
  // -------- top of game ----------- 
  // 
  // platform ceiling offset
  // 
  // ---------------------------------------
  // 
  //          
  // game.height - plat ceiling offset - platform floor offset 
  // ( the platforms will appear within this range )
  // 
  // 
  // -----------------------------------
  // 
  // -------- bottom of game------------------
  while (true) {

    var bias = ( player.position.y / windowH );

    // flipping percentage value so bias is not oppisite to where player is
    bias = ( 1 - bias );
    // expanding bias by 2 to create 
    bias *= 2;

    // if ( bias > 1 ) {
    //   bias *=  biasTowardsBottomMultiplier;
    // }
    // else {
    //   bias /= biasTowardsTopMultiplier;
    // }

    var randBiased = Math.pow(Math.random(), bias);

    var platYPos =  platformCeilingOffset + ( randBiased * ( game.height - platformCeilingOffset - platformFloorOffset ) );
    var temp1 = Math.abs(platYPos);
    var temp2 = Math.abs(prevPlatYPos);
    var diffFromPrevPos = Math.abs( temp1 - temp2 );

    if ( diffFromPrevPos > minPlatformYDist ) {
      if ( diffFromPrevPos < maxPlatformYDist ) {
        break;
      }
    }
  }

  var ledge = platformsGroup.create(game.world.width, platYPos, platformSprite);

  ledge.body.velocity.x = -scrollSpeed;
  ledge.body.immovable = true;
  ledge.width = platformWidth;

  prevPlatYPos = platYPos;
}

function createHeightedPlatform(height, xPos, width) {
  var ledge = platformsGroup.create(game.world.width, height, platformSprite);
  ledge.body.velocity.x = -scrollSpeed;
  ledge.body.immovable = true;
  ledge.width = width;
}

function destroyOldPlatforms() {
  //get rid of old platforms once they goes offscreen
  platformsGroup.forEach(function(platform) {
    if (platform.x < -platform.width) {
      platform.kill();
    }
  });
}

function killPlatformsAndGround() {
  platformsGroup.forEach(function(platform) {
    platform.kill();
  });

  groundGroup.forEach(function(ground) {
    ground.kill();
  });
}

@@ -1102,16 +1102,19 @@
 ------%0A 
+ //
  while (
@@ -1123,16 +1123,19 @@
 ue) %7B%0A%0A 
+ //
    var b
@@ -1171,24 +1171,27 @@
 indowH );%0A%0A 
+ //
    // flippi
@@ -1254,16 +1254,19 @@
 yer is%0A 
+ //
    bias 
@@ -1282,16 +1282,19 @@
 ias );%0A 
+ //
    // ex
@@ -1323,16 +1323,19 @@
 reate %0A 
+ //
    bias 
@@ -1343,18 +1343,21 @@
 = 2;%0A%0A  
+//
   
+ 
 // if ( 
@@ -1366,24 +1366,27 @@
 as %3E 1 ) %7B%0A 
+ //
    //   bias
@@ -1412,32 +1412,35 @@
 tomMultiplier;%0A 
+ //
    // %7D%0A    // e
@@ -1432,16 +1432,19 @@
   // %7D%0A 
+ //
    // el
@@ -1449,16 +1449,19 @@
 else %7B%0A 
+ //
    //   
@@ -1500,17 +1500,23 @@
 ;%0A  
+//
   
+ 
 // %7D%0A%0A 
+ //
    v
@@ -1564,16 +1564,19 @@
 ias);%0A%0A 
+ //
    var p
@@ -1687,24 +1687,27 @@
 ffset ) );%0A 
+ //
    var temp1
@@ -1726,24 +1726,27 @@
 platYPos);%0A 
+ //
    var temp2
@@ -1774,18 +1774,21 @@
 Pos);%0A  
+//
   
+ 
 var diff
@@ -1831,18 +1831,21 @@
 2 );%0A%0A  
+//
   
+ 
 if ( dif
@@ -1877,24 +1877,27 @@
 mYDist ) %7B%0A 
+ //
      if ( di
@@ -1930,24 +1930,27 @@
 mYDist ) %7B%0A 
+ //
        break
@@ -1952,16 +1952,19 @@
 break;%0A 
+ //
      %7D%0A 
@@ -1964,21 +1964,27 @@
     %7D%0A  
+//
   
+ 
 %7D%0A 
+ //
  %7D%0A%0A  va
@@ -2033,24 +2033,19 @@
 .width, 
-platYPos
+500
 , platfo
@@ -2160,16 +2160,19 @@
 idth;%0A%0A 
+ //
  prevPla

Remove random platform Y