var goGround = function (game, options, api) {
    var self = {};
    self.name = "ground";
    var ground = game.add.group();
    var groundBlocks = [];

    self.getObject = function () {
        return ground;
    }

    self.moveObject = function (relX, relY) {
        ground.forEach(function (member) {
            member.x += relX;
        }, this);
    }

    self.preload = function () {
        game.load.image(self.name, 'resources/images/tempmaa.png');
    }

    self.SetConfig = function (groundObjects) {
        groundBlocks = groundObjects;
    }

    self.create = function () {
        var cWidth = 0;
        for (var x = 0; x < groundBlocks.length; x++) {
            // Add the ground blocks, enable physics on each, make them immovable
            //var groundBlock = game.add.sprite(groundBlocks[x][2], groundBlocks[x][1], groundBlocks[x][0]);
            var groundBlock = game.add.sprite(cWidth, groundBlocks[x][1], groundBlocks[x][0]);
            cWidth += groundBlock.width;
            game.physics.enable(groundBlock, Phaser.Physics.ARCADE);
            groundBlock.body.immovable = true;
            groundBlock.body.allowGravity = false;
            ground.add(groundBlock);
        }
        game.world.bringToTop(ground);
    }

    return self;
}