public DebugScreen(ContentManager cm, GraphicsDeviceManager gdm, SpriteBatch sb, Color sColor) : base(cm, gdm, sb)
        {
            //configures default map
            //TO DO: fix tile map to be instan
            map = new TileMap(cm, gdm, sb, new Vector2(160, 45), new Vector2(16, 16));

            playerOneCamera = new Camera(cm, gdm, sb, new Vector2(0, 0), graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width, graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera = new Camera(cm, gdm, sb, new Vector2(0, 0), graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera.screenPosition = new Vector2(graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, 0);

            screenColor = sColor;

            playerOne = new Player(cm, sb, gdm);
            //playerTwo = new Player(cm, sb, gdm);
            //playerTwo.currentWorldPosition = playerTwoCamera.worldPosition;

            platformOne = new TiledPlatform(cm, sb, gdm, true, true, true, true);
            platformOne.platformSize = new Vector2(20, 5);
            platformOne.position     = new Vector2(map.getTileMapWidthInPixels / 2 - platformOne.platformWidth / 2, map.getTileMapHeightInPixels - platformOne.platformHeight);

            hurdleOne = new Hurdle(cm, gdm, sb);
            hurdleOne.worldPosition = new Vector2(map.getTileMapWidthInPixels / 4, map.getTileMapHeightInPixels - hurdleOne.height);

            hurdleTwo = new Hurdle(cm, gdm, sb);
            hurdleTwo.worldPosition = new Vector2(map.getTileMapWidthInPixels / 2 - hurdleTwo.width / 2, map.getTileMapHeightInPixels - platformOne.platformHeight - hurdleTwo.height);

            momentumButtonOne = new MomentumActionButton(cm, gdm, sb, new Vector2(0, 25));
            momentumButtonOne.worldPosition = new Vector2(map.getTileMapWidthInPixels / 2 - momentumButtonOne.width / 2, platformOne.position.Y - 40);

            gravity = new Vector2(0, 9);
        }
Ejemplo n.º 2
0
        //not really sure how I want to implement this, I need to refine a binary search for the correct placement....
        public Vector2 checkAndFixTiledPlatformCollision(Vector2 newPos, Player playerOne)
        {
            //------------
            //First phase is to check for a collision and to mark collisions accordingly
            // will operate on the basis that the values returned for the collision are against the players sides/top/bottom and the rectangle of the tile platform
            //------------

            TiledPlatform tp = this;

            //makes the current tileplatform rectangle reference, not sure if this is done via call by reference
            Rectangle previousTileComparisionRect = tp.boundingRectangle;
            Rectangle currentTileComparisionRect  = tp.boundingRectangle;
            //playerOne left side
            Rectangle tpLeftRectSide = new Rectangle(currentTileComparisionRect.X, currentTileComparisionRect.Y, 1, currentTileComparisionRect.Height);
            //playerOne right side, has a -1 offset to the x value so that it's overlapping correctly for comparison
            Rectangle tpRightRectSide = new Rectangle(currentTileComparisionRect.Right, currentTileComparisionRect.Y, 1, currentTileComparisionRect.Height);
            //playerOne top side
            Rectangle tpTopRectSide = new Rectangle(currentTileComparisionRect.X, currentTileComparisionRect.Y, currentTileComparisionRect.Width, 1);
            //playerOne bottom side, has a -1 offset to the y value so that it's overlapping correctly for comparison
            Rectangle tpBottomRectSide = new Rectangle(currentTileComparisionRect.X, currentTileComparisionRect.Bottom, currentTileComparisionRect.Width, 1);

            //makes playerOne rectangle reference
            Rectangle previousPlayerComparisionRect = new Rectangle((int)newPos.X, (int)newPos.Y, (int)playerOne.width, (int)playerOne.height);
            Rectangle currentPlayerComparisionRect  = new Rectangle((int)newPos.X, (int)newPos.Y, (int)playerOne.width, (int)playerOne.height);
            //playerOne left side
            Rectangle playerLeftRectSide = new Rectangle(currentPlayerComparisionRect.X, currentPlayerComparisionRect.Y, 1, currentPlayerComparisionRect.Height);
            //playerOne right side, has a -1 offset to the x value so that it's overlapping correctly for comparison
            Rectangle playerRightRectSide = new Rectangle(currentPlayerComparisionRect.Right, currentPlayerComparisionRect.Y, 1, currentPlayerComparisionRect.Height);
            //playerOne top side
            Rectangle playerTopRectSide = new Rectangle(currentPlayerComparisionRect.X, currentPlayerComparisionRect.Y, currentPlayerComparisionRect.Width, 1);
            //playerOne bottom side, has a -1 offset to the y value so that it's overlapping correctly for comparison
            Rectangle playerBottomRectSide = new Rectangle(currentPlayerComparisionRect.X, currentPlayerComparisionRect.Bottom, currentPlayerComparisionRect.Width, 1);

            //System.Diagnostics.Debug.WriteLine("Current Collision Box X: " + currentPlayerComparisionRect.X);
            //System.Diagnostics.Debug.WriteLine("Current Collision Box Y: " + currentPlayerComparisionRect.Y);

            //System.Diagnostics.Debug.WriteLine("Current Collision Box X: " + currentTileComparisionRect.X);
            //System.Diagnostics.Debug.WriteLine("Current Collision Box Y: " + currentTileComparisionRect.Y);

            //right tileplatform hit, left side of playerOne hit
            if (currentPlayerComparisionRect.Intersects(tpRightRectSide) && collidableOnRight)
            {
                playerOne.collisionOnPlayerLeft = true;
                //System.Diagnostics.Debug.WriteLine("Left Collision");
            }
            //left tile platform hit, right side of playerOne hit
            if (currentPlayerComparisionRect.Intersects(tpLeftRectSide) && collidableOnLeft)
            {
                playerOne.collisionOnPlayerRight = true;
                //System.Diagnostics.Debug.WriteLine("Right Collision");
            }
            //bottom of platform hit, top of playerOne hit
            if (currentPlayerComparisionRect.Intersects(tpBottomRectSide) && collidableOnBottom)
            {
                playerOne.collisionOnPlayerTop = true;
                //System.Diagnostics.Debug.WriteLine("Top Collision");
            }
            //top of platform hit, bottom of playerOne hit
            //this is where dash and jump and falling are reset
            if (currentPlayerComparisionRect.Intersects(tpTopRectSide) && collidableOnTop)
            {
                playerOne.collisionOnPlayerBottom = true;
                //System.Diagnostics.Debug.WriteLine("Bottom Collision");
            }
            //*****
            //I'm pretty positive that this may be a problem in the future. I don't know.... I've never implemented collision like this...
            //this nested if statement basically says don't fix any collision on bottom if jumping
            //I'm pretty sure this will mess me up later, but at the moment I'm letting it slide because wow, it really fixes the
            //controls, if you can in the future fix this to work around any bugs. Try to keep this for the logic.
            if (playerOne.collisionOnPlayerBottom && playerOne.isJumping)
            {
                playerOne.collisionOnPlayerBottom = false;
            }

            //this is to fix landing collision so that if there is a bottom collision as long as you're not falling left and right are false
            if (playerOne.collisionOnPlayerBottom)
            {
                if (playerOne.collisionOnPlayerLeft)
                {
                    if (tpRightRectSide.X - playerLeftRectSide.X < playerBottomRectSide.Y - tpTopRectSide.Y)
                    {
                        playerOne.collisionOnPlayerBottom = false;
                    }
                    else
                    {
                        playerOne.collisionOnPlayerLeft = false;
                    }
                }
                if (playerOne.collisionOnPlayerRight)
                {
                    if (playerRightRectSide.X - tpLeftRectSide.X < playerBottomRectSide.Y - tpTopRectSide.Y)
                    {
                        playerOne.collisionOnPlayerBottom = false;
                    }
                    else
                    {
                        playerOne.collisionOnPlayerRight = false;
                    }
                }
            }

            //top collision
            if (playerOne.collisionOnPlayerTop)
            {
                if (playerOne.collisionOnPlayerLeft)
                {
                    if (tpRightRectSide.X - playerLeftRectSide.X < tpBottomRectSide.Y - playerTopRectSide.Y)
                    {
                        playerOne.collisionOnPlayerTop = false;
                    }
                    else
                    {
                        playerOne.collisionOnPlayerLeft = false;
                    }
                }
                if (playerOne.collisionOnPlayerRight)
                {
                    if (playerRightRectSide.X - tpLeftRectSide.X < tpBottomRectSide.Y - playerTopRectSide.Y)
                    {
                        playerOne.collisionOnPlayerBottom = false;
                    }
                    else
                    {
                        playerOne.collisionOnPlayerRight = false;
                    }
                }
            }

            //if any collision occured then update the flag so that a general marker is known
            if (playerOne.collisionOnPlayerLeft ||
                playerOne.collisionOnPlayerRight ||
                playerOne.collisionOnPlayerTop ||
                playerOne.collisionOnPlayerBottom)
            {
                playerOne.playerCollisionOccurred = true;
            }

            //------------
            //second phase is to respond accordingly
            //------------

            if (playerOne.playerCollisionOccurred)
            {
                //left was hit
                if (playerOne.collisionOnPlayerLeft)
                {
                    while (currentPlayerComparisionRect.Intersects(tpRightRectSide))
                    {
                        ///
                        /// resets the values hopefully using a call by value here to that we're getting the numbers and not the reference to previous position
                        /// This is an important nuance on account that it makes it so all our collision checking is done through rectangled abstraction. This means
                        /// we're just using the values to initialze the rectangles and then updating the collision from there, at the end when the fix is to exit the
                        /// rectangle will set the playerOne position appropriately
                        ///
                        float widthMidpointDistance = (previousPlayerComparisionRect.X - tpRightRectSide.X) / 2;

                        //update previous and current rectangle reference before modifying their values
                        previousPlayerComparisionRect   = currentPlayerComparisionRect;
                        currentPlayerComparisionRect.X -= (int)widthMidpointDistance;

                        playerLeftRectSide.Location = currentPlayerComparisionRect.Location;

                        //checks to see if the midpoint modifying the position causes it to hit the tile platform
                        //if it does the rectangle is set to the previous rectangle and
                        if (currentPlayerComparisionRect.Intersects(tpRightRectSide))
                        {
                            currentPlayerComparisionRect.X = currentTileComparisionRect.Right + (int)widthMidpointDistance + 1;
                            playerLeftRectSide.Location    = currentPlayerComparisionRect.Location;
                        }
                    }
                    newPos.X = currentPlayerComparisionRect.X;
                }
                //right was hit
                //pretty questionable when it feels like it seems to zoom through the block, i think I've rectified the issue but the dash
                //causes it to look a little more aggressive on its position modification.... possible bug here
                if (playerOne.collisionOnPlayerRight)
                {
                    while (currentPlayerComparisionRect.Intersects(tpLeftRectSide))
                    {
                        ///
                        /// resets the values hopefully using a call by value here to that we're getting the numbers and not the reference to previous position
                        /// This is an important nuance on account that it makes it so all our collision checking is done through rectangled abstraction. This means
                        /// we're just using the values to initialze the rectangles and then updating the collision from there, at the end when the fix is to exit the
                        /// rectangle will set the playerOne position appropriately
                        ///
                        float widthMidpointDistance = (tpLeftRectSide.X - previousPlayerComparisionRect.Right) / 2;

                        //update previous and current rectangle reference before modifying their values
                        previousPlayerComparisionRect   = currentPlayerComparisionRect;
                        currentPlayerComparisionRect.X += (int)widthMidpointDistance;

                        playerRightRectSide.X = currentPlayerComparisionRect.Right;

                        //checks to see if the midpoint modifying the position causes it to hit the tile platform
                        //if it does the rectangle is set to the previous rectangle and
                        if (currentPlayerComparisionRect.Intersects(tpLeftRectSide))
                        {
                            currentPlayerComparisionRect.X = currentTileComparisionRect.Left - (int)widthMidpointDistance - currentPlayerComparisionRect.Width - 1;
                            playerRightRectSide.X          = currentPlayerComparisionRect.Right;
                        }
                    }
                    newPos.X = currentPlayerComparisionRect.X;
                }
                //top was hit
                if (playerOne.collisionOnPlayerTop)
                {
                    while (currentPlayerComparisionRect.Intersects(tpBottomRectSide))
                    {
                        ///
                        /// resets the values hopefully using a call by value here to that we're getting the numbers and not the reference to previous position
                        /// This is an important nuance on account that it makes it so all our collision checking is done through rectangled abstraction. This means
                        /// we're just using the values to initialze the rectangles and then updating the collision from there, at the end when the fix is to exit the
                        /// rectangle will set the playerOne position appropriately
                        ///

                        float heightMidpointDistance = (currentPlayerComparisionRect.Top - tpBottomRectSide.Y) / 2;

                        //update previous and current rectangle reference before modifying their values
                        previousPlayerComparisionRect   = currentPlayerComparisionRect;
                        currentPlayerComparisionRect.Y += (int)heightMidpointDistance;

                        playerTopRectSide.Y = currentPlayerComparisionRect.Top;

                        //checks to see if the midpoint modifying the position causes it to hit the tile platform
                        //if it does the rectangle is set to the previous rectangle and
                        if (currentPlayerComparisionRect.Intersects(tpBottomRectSide))
                        {
                            currentPlayerComparisionRect.Y = currentTileComparisionRect.Bottom + (int)heightMidpointDistance + 1;
                            playerTopRectSide.Y            = currentPlayerComparisionRect.Top;
                        }
                    }
                    newPos.Y = currentPlayerComparisionRect.Y;
                    //playerOne.isJumping = false;
                    //playerOne.isFalling = true;
                }

                //bottom was hit
                if (playerOne.collisionOnPlayerBottom)
                {
                    while (currentPlayerComparisionRect.Intersects(tpTopRectSide))
                    {
                        ///
                        /// resets the values hopefully using a call by value here to that we're getting the numbers and not the reference to previous position
                        /// This is an important nuance on account that it makes it so all our collision checking is done through rectangled abstraction. This means
                        /// we're just using the values to initialze the rectangles and then updating the collision from there, at the end when the fix is to exit the
                        /// rectangle will set the playerOne position appropriately
                        ///

                        float heightMidpointDistance = (tpTopRectSide.Y - playerBottomRectSide.Y) / 2;

                        //update previous and current rectangle reference before modifying their values
                        previousPlayerComparisionRect   = currentPlayerComparisionRect;
                        currentPlayerComparisionRect.Y += (int)heightMidpointDistance;

                        playerBottomRectSide.Y = currentPlayerComparisionRect.Bottom;

                        //checks to see if the midpoint modifying the position causes it to hit the tile platform
                        //if it does the rectangle is set to the previous rectangle and
                        if (currentPlayerComparisionRect.Intersects(tpTopRectSide))
                        {
                            currentPlayerComparisionRect.Y = currentTileComparisionRect.Y - (int)heightMidpointDistance - (int)playerOne.height - 2;
                            playerBottomRectSide.Y         = currentPlayerComparisionRect.Bottom;
                        }
                    }

                    //fixes falling collision for gravity falls with platform
                    if (playerOne.isFalling || playerOne.isFallingFromGravity)
                    {
                        if (playerOne.isFalling)
                        {
                            playerOne.isFalling = false;
                            if (playerOne.movingRight || playerOne.movingLeft)
                            {
                                playerOne.playerImageSheet.setFrameConfiguration(18, 18, 28);
                                playerOne.playerImageSheet.frameTimeLimit = 8;
                            }
                        }
                        if (playerOne.isFallingFromGravity)
                        {
                            playerOne.isFallingFromGravity = false;
                            if (playerOne.movingRight || playerOne.movingLeft)
                            {
                                playerOne.playerImageSheet.setFrameConfiguration(18, 18, 28);
                                playerOne.playerImageSheet.frameTimeLimit = 8;
                            }
                            else if (playerOne.standing)
                            {
                                playerOne.playerImageSheet.setFrameConfiguration(0, 0, 4);
                                playerOne.playerImageSheet.frameTimeLimit = 8;
                            }
                        }
                        if (playerOne.exhaustedDash)
                        {
                            playerOne.exhaustedDash = false;
                        }
                    }

                    newPos.Y                       = currentPlayerComparisionRect.Y;
                    playerOne.isJumping            = false;
                    playerOne.isFalling            = false;
                    playerOne.isFallingFromGravity = false;
                    playerOne.isDashing            = false;
                    playerOne.exhaustedDash        = false;
                }

                if (playerOne.playerCollisionOccurred)
                {
                    playerOne.playerCollisionOccurred = false;
                    playerOne.collisionOnPlayerLeft   = false;
                    playerOne.collisionOnPlayerRight  = false;
                    playerOne.collisionOnPlayerTop    = false;
                    playerOne.collisionOnPlayerBottom = false;
                }

                return(newPos);
            }
            else
            {
                if (playerOne.playerCollisionOccurred)
                {
                    playerOne.playerCollisionOccurred = false;
                    playerOne.collisionOnPlayerLeft   = false;
                    playerOne.collisionOnPlayerRight  = false;
                    playerOne.collisionOnPlayerTop    = false;
                    playerOne.collisionOnPlayerBottom = false;
                }

                return(newPos);
            }

            //TO DO: finish the collision code so that it does corners and sides with out issues

            //------------
            //third phase is to reset flags
            //------------
        }
        public RegalFalls(ContentManager cm, GraphicsDeviceManager gdm, SpriteBatch sb, Color sColor) : base(cm, gdm, sb)
        {
            //configures default map
            map = new TileMap(cm, gdm, sb, new Vector2(160, 45), new Vector2(16, 16));
            //----------------------------------------------------------Start Map Configuration----------------------------------------
            int tileTrackerX = 0;
            int tileTrackerY = 0;

            //iterates through row by column and initializes based on some arbitrary distinctions
            while (tileTrackerY < map.tileMapHeight)
            {
                while (tileTrackerX < map.tileMapWidth)
                {
                    /*
                     * if (tileTrackerX == map.tileMapWidth / 2)
                     * {
                     *  map.tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(map.tilePositionX, map.tilePositionY), new Vector2(80, 16), new Vector2(5, 1), "TileMapImages/AltBasicTileSet", true, true, false, false);
                     *  map.tiles[tileTrackerX, tileTrackerY].isCollidable = true;
                     *  map.tiles[tileTrackerX, tileTrackerY].baseTileImage.setFrameConfiguration(4, 4, 4);
                     * }
                     * else if (tileTrackerY == map.tileMapHeight / 2)
                     * {
                     *  map.tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(map.tilePositionX, map.tilePositionY), new Vector2(80, 16), new Vector2(5, 1), "TileMapImages/AltBasicTileSet", false, false, true, true);
                     *  map.tiles[tileTrackerX, tileTrackerY].isCollidable = true;
                     *  map.tiles[tileTrackerX, tileTrackerY].baseTileImage.setFrameConfiguration(4, 4, 4);
                     * }*/
                    //else {
                    map.tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(map.tilePositionX, map.tilePositionY), new Vector2(80, 16), new Vector2(5, 1), "TileMapImages/AltBasicTileSet", false, false, false, false);

                    //bottom
                    if (tileTrackerX > map.tileMapWidth / 2)
                    {
                        //bottom right
                        if (tileTrackerY > map.tileMapHeight / 2)
                        {
                            map.tiles[tileTrackerX, tileTrackerY].baseTileImage.setFrameConfiguration(3, 3, 3);
                        }
                        //bottom left
                        else
                        {
                            map.tiles[tileTrackerX, tileTrackerY].baseTileImage.setFrameConfiguration(2, 2, 2);
                        }
                    }
                    //top
                    else
                    {
                        //top right
                        if (tileTrackerY > map.tileMapHeight / 2)
                        {
                            map.tiles[tileTrackerX, tileTrackerY].baseTileImage.setFrameConfiguration(1, 1, 1);
                        }
                        //top left
                        else
                        {
                            map.tiles[tileTrackerX, tileTrackerY].baseTileImage.setFrameConfiguration(0, 0, 0);
                        }
                    }
                    //}
                    //tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(tilePositionX, tilePositionY), new Vector2(80, 16), new Vector2(5, 1), "TileMapImages/BasicTileSet");

                    //tiles[tileTrackerX, tileTrackerY] = new BackgroundTile(cm, gdm, sb, new Vector2(tilePositionX, tilePositionY), imageLibrary.basicTileSet);
                    map.tilePositionX += map.defaultTileWidth;

                    tileTrackerX++;
                }
                map.tilePositionX  = 0;
                tileTrackerX       = 0;
                map.tilePositionY += map.defaultTileHeight;
                tileTrackerY++;
            }
            //----------------------------------------------------------End Map Configuration----------------------------------------
            playerOneCamera = new Camera(cm, gdm, sb, new Vector2(0, 0), graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width, graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera = new Camera(cm, gdm, sb, new Vector2(0, 0), graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Height);
            //playerTwoCamera.screenPosition = new Vector2(graphicsDeviceManagerReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2, 0);

            screenColor = sColor;

            playerOne = new Player(cm, sb, gdm);
            playerOne.previousWorldPosition = new Vector2(0, map.getTileMapHeightInPixels - playerOne.height);
            playerOne.currentWorldPosition  = new Vector2(0, map.getTileMapHeightInPixels - playerOne.height);
            //playerTwo = new Player(cm, sb, gdm);
            //playerTwo.currentWorldPosition = playerTwoCamera.worldPosition;

            platformOne = new TiledPlatform(cm, sb, gdm, true, true, false, false);
            platformOne.platformSize = new Vector2(5, 5);
            platformOne.position     = new Vector2(map.getTileMapWidthInPixels / 2 - platformOne.platformWidth / 2, map.getTileMapHeightInPixels - platformOne.platformHeight);

            platformTwo = new TiledPlatform(cm, sb, gdm, true, true, false, false);
            platformTwo.platformSize = new Vector2(5, 5);
            platformTwo.position     = new Vector2(map.getTileMapWidthInPixels / 2 - platformOne.platformWidth / 2, map.getTileMapHeightInPixels - platformOne.platformHeight - platformTwo.platformHeight);

            platformThree = new TiledPlatform(cm, sb, gdm, false, false, true, false);
            platformThree.platformSize = new Vector2(5, 5);
            platformThree.position     = new Vector2(map.getTileMapWidthInPixels / 2 - platformOne.platformWidth / 2, map.getTileMapHeightInPixels - platformOne.platformHeight - platformTwo.platformHeight - platformThree.platformHeight);

            platformFour = new TiledPlatform(cm, sb, gdm, true, false, true, true);
            platformFour.platformSize = new Vector2(5, 5);
            platformFour.position     = new Vector2(map.getTileMapWidthInPixels / 2 - platformOne.platformWidth / 2 - platformThree.platformWidth, map.getTileMapHeightInPixels - platformOne.platformHeight - platformTwo.platformHeight - platformThree.platformHeight);

            platformFive = new TiledPlatform(cm, sb, gdm, false, true, true, true);
            platformFive.platformSize = new Vector2(5, 5);
            platformFive.position     = new Vector2(map.getTileMapWidthInPixels / 2 - platformOne.platformWidth / 2 + platformThree.platformWidth, map.getTileMapHeightInPixels - platformOne.platformHeight - platformTwo.platformHeight - platformThree.platformHeight);

            hurdleOne = new Hurdle(cm, gdm, sb);
            hurdleOne.worldPosition = new Vector2(map.getTileMapWidthInPixels / 4, map.getTileMapHeightInPixels - hurdleOne.height);

            hurdleTwo = new Hurdle(cm, gdm, sb);
            hurdleTwo.worldPosition = new Vector2(map.getTileMapWidthInPixels / 2 - 400, map.getTileMapHeightInPixels - platformOne.platformHeight - hurdleTwo.height);

            momentumButtonOne = new MomentumActionButton(cm, gdm, sb, new Vector2(15, -25));
            momentumButtonOne.worldPosition = new Vector2(map.getTileMapWidthInPixels / 2 - momentumButtonOne.width / 2, platformOne.position.Y - 200);

            gravity = new Vector2(0, 9);
        }