Ejemplo n.º 1
0
 //draws at different position
 public void DrawAltPosition(Vector2 position)
 {
     if (facingRight)
     {
         playerImageSheet.DrawAltPosition(position, false);
     }
     else if (facingLeft)
     {
         playerImageSheet.DrawAltPosition(position, true);
     }
 }
Ejemplo n.º 2
0
        public override void draw(GameTime gameTimer)
        {
            if (gameMode == GameMode.SinglePlayer)
            {
                sbReference.Begin();

                //-------------------------playerOne UNDERLAY BEGINS HERE-------------------------
                //playerOne one underlay
                redTile.DrawAltPosition(new Vector2(characterOneUnderlay.X, characterOneUnderlay.Y), false, new Vector2(characterOneUnderlay.Width / 16, characterOneUnderlay.Height / 16), 1f);
                imageLibrary.characterOneSpriteSheet.setFrameConfiguration(0, 0, 0);
                imageLibrary.characterOneSpriteSheet.DrawAltPosition(new Vector2(characterOneUnderlay.X + characterOneUnderlay.Width - imageLibrary.characterOneSpriteSheet.frameSize.X - 50, characterOneUnderlay.Y + 40), false, 0f);
                //playerOne two underlay
                orangeTile.DrawAltPosition(new Vector2(characterTwoUnderlay.X, characterTwoUnderlay.Y), false, new Vector2(characterTwoUnderlay.Width / 16, characterTwoUnderlay.Height / 16), 1f);
                imageLibrary.characterTwoSpriteSheet.setFrameConfiguration(0, 0, 0);
                imageLibrary.characterTwoSpriteSheet.DrawAltPosition(new Vector2(characterTwoUnderlay.X + 50, characterOneUnderlay.Y + 40), true, 0f);
                //playerOne three underlay
                yellowTile.DrawAltPosition(new Vector2(characterThreeUnderlay.X, characterThreeUnderlay.Y), false, new Vector2(characterThreeUnderlay.Width / 16, characterThreeUnderlay.Height / 16), 1f);
                //playerOne four underlay
                greenTile.DrawAltPosition(new Vector2(characterFourUnderlay.X, characterFourUnderlay.Y), false, new Vector2(characterFourUnderlay.Width / 16, characterFourUnderlay.Height / 16), 1f);
                //-------------------------playerOne UNDERLAY ENDS HERE-------------------------

                if (playerOne != null)
                {
                    if (playerOneSelector.hoverHorizontalSelection == 0 && playerOneSelector.hoverVerticalSelection == 0)
                    {
                        playerOneSelector.drawAltPosition(new Vector2(characterOneUnderlay.X, characterOneUnderlay.Y));
                    }
                    else if (playerOneSelector.hoverHorizontalSelection == 1 && playerOneSelector.hoverVerticalSelection == 0)
                    {
                        playerOneSelector.drawAltPosition(new Vector2(characterTwoUnderlay.X, characterTwoUnderlay.Y));
                    }
                    else if (playerOneSelector.hoverHorizontalSelection == 0 && playerOneSelector.hoverVerticalSelection == 1)
                    {
                        playerOneSelector.drawAltPosition(new Vector2(characterThreeUnderlay.X, characterThreeUnderlay.Y));
                    }
                    else if (playerOneSelector.hoverHorizontalSelection == 1 && playerOneSelector.hoverVerticalSelection == 1)
                    {
                        playerOneSelector.drawAltPosition(new Vector2(characterFourUnderlay.X, characterFourUnderlay.Y));
                    }
                }

                sbReference.DrawString(gameFont, "Character Selection!", new Vector2(gdmReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2 - 290, 20), Color.White, 0.0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f);
                sbReference.DrawString(gameFont, "Press Start To Join", new Vector2(gdmReference.GraphicsDevice.Viewport.TitleSafeArea.Width / 2 - 130, 100), Color.White, 0.0f, new Vector2(0, 0), .5f, SpriteEffects.None, 0f);
                sbReference.End();
            }
        }
Ejemplo n.º 3
0
 public void drawAltPosition(Vector2 altPos)
 {
     imageSheet.DrawAltPosition(altPos);
 }
Ejemplo n.º 4
0
 public void DrawAltPosition(Vector2 altPos)
 {
     imageSheet.DrawAltPosition(altPos, false, platformSize, layerDepth);
 }
Ejemplo n.º 5
0
        public void drawAltPosition(Vector2 startSlopePosition, Vector2 endSlopePosition)
        {
            //sbReference.Draw(slopeTexture, new Rectangle((int)(altPos.X + xTracker), (int)(altLine.yAtX(altPos.X-xTracker)), (int)slopeTexture.Width, (int)slopeTexture.Height), null, Color.White, (float)(rotation * (Math.PI / 180)), Vector2.Zero, SpriteEffects.FlipHorizontally, 0f);
            Rectangle tempRectangle = platformSlope.getAltBoundingRectangle(startSlopePosition);

            if (startSlopePosition.Y > endSlopePosition.Y)
            {
                tempRectangle = platformSlope.getAltBoundingRectangle(new Vector2(startSlopePosition.X, endSlopePosition.Y));
            }

            Line  altLine  = new Line(startSlopePosition, endSlopePosition);
            float slope    = Math.Abs(altLine.getSlope());
            float rotation = (float)(180 / Math.PI * Math.Atan((platformSlope.pt2.Y - platformSlope.pt1.Y) / (platformSlope.pt2.X - platformSlope.pt1.X)));

            //System.Diagnostics.Debug.WriteLine(rotation);
            float xTracker = 0;

            //System.Diagnostics.Debug.WriteLine("Start X: " + platformSlope.getBoundingRectangle.X);
            //System.Diagnostics.Debug.WriteLine("Start Y: " + startYPos);
            //System.Diagnostics.Debug.WriteLine("Alt Y: " + altPos.Y);
            //System.Diagnostics.Debug.WriteLine("Width: " + platformSlope.getBoundingRectangle.Width);
            //System.Diagnostics.Debug.WriteLine(altLine.getSlope());

            while (tempRectangle.Left + xTracker < tempRectangle.Right)
            {
                if (xTracker == 0)
                {
                    slopeTexture.setFrameConfiguration(1, 1, 1);
                }
                else if (tempRectangle.Left + xTracker != tempRectangle.Right - 16)
                {
                    slopeTexture.setFrameConfiguration(1, 1, 1);
                }
                else if (tempRectangle.Left + xTracker > tempRectangle.Right - 16)
                {
                    slopeTexture.setFrameConfiguration(1, 1, 1);
                }

                if (tempRectangle.Left + xTracker > tempRectangle.Right - 16)
                {
                    slopeTexture.DrawAltPosition(new Vector2(tempRectangle.Right - 16, altLine.yAtX(tempRectangle.Right - 16)), false, rotation, layerDepth + .01f);
                }
                else
                {
                    slopeTexture.DrawAltPosition(new Vector2(tempRectangle.Left + xTracker, altLine.yAtX(tempRectangle.Left + xTracker)), false, rotation, layerDepth);
                }


                //draws the platform slope texture

                //-------------------------------

                float xTrackerModifier = (float)Math.Abs(Math.Cos(rotation) * 16);
                //System.Diagnostics.Debug.WriteLine(xTrackerModifier);
                if (xTrackerModifier > 16)
                {
                    xTracker += 16;
                }
                else
                {
                    if (slope < 1)
                    {
                        xTracker += xTrackerModifier;
                    }
                    else
                    {
                        xTracker += 8;
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public void drawAltPosition(Vector2 altPos)
 {
     imageSheet.DrawAltPosition(altPos, false, layerDepth);
 }
 public void DrawAltPosition(Vector2 altPos)
 {
     imageSheet.DrawAltPosition(altPos, false, true, platformSize);
 }
        public void drawAltPosition(Vector2 startSlopePosition, Vector2 endSlopePosition)
        {
            //sbReference.Draw(slopeTexture, new Rectangle((int)(altPos.X + xTracker), (int)(altLine.yAtX(altPos.X-xTracker)), (int)slopeTexture.Width, (int)slopeTexture.Height), null, Color.White, (float)(rotation * (Math.PI / 180)), Vector2.Zero, SpriteEffects.FlipHorizontally, 0f);
            Rectangle tempRectangle = platformSlope.getAltBoundingRectangle(startSlopePosition);

            if (startSlopePosition.Y > endSlopePosition.Y)
            {
                tempRectangle = platformSlope.getAltBoundingRectangle(new Vector2(startSlopePosition.X, endSlopePosition.Y));
            }

            Line  altLine  = new Line(startSlopePosition, endSlopePosition);
            float slope    = Math.Abs(altLine.getSlope());
            float rotation = (float)(180 / Math.PI * Math.Atan((platformSlope.pt2.Y - platformSlope.pt1.Y) / (platformSlope.pt2.X - platformSlope.pt1.X)));

            //System.Diagnostics.Debug.WriteLine(rotation);
            float xTracker = 0;
            float yTracker = 0;

            //System.Diagnostics.Debug.WriteLine("Start X: " + platformSlope.getBoundingRectangle.X);
            //System.Diagnostics.Debug.WriteLine("Start Y: " + startYPos);
            //System.Diagnostics.Debug.WriteLine("Alt Y: " + altPos.Y);
            //System.Diagnostics.Debug.WriteLine("Width: " + platformSlope.getBoundingRectangle.Width);
            //System.Diagnostics.Debug.WriteLine(altLine.getSlope());

            while (tempRectangle.Left + xTracker < tempRectangle.Right)
            {
                if (xTracker == 0)
                {
                    if (collidableOnLeftSide)
                    {
                        slopeTexture.setFrameConfiguration(0, 0, 0);
                    }
                    else
                    {
                        slopeTexture.setFrameConfiguration(1, 1, 1);
                    }
                }
                else if (tempRectangle.Left + xTracker != tempRectangle.Right - 16)
                {
                    slopeTexture.setFrameConfiguration(1, 1, 1);
                }
                else if (tempRectangle.Left + xTracker > tempRectangle.Right - 16)
                {
                    if (collidableOnRightSide)
                    {
                        slopeTexture.setFrameConfiguration(2, 2, 2);
                    }
                    else
                    {
                        slopeTexture.setFrameConfiguration(1, 1, 1);
                    }
                }

                if (tempRectangle.Left + xTracker > tempRectangle.Right - 16)
                {
                    slopeTexture.DrawAltPosition(new Vector2(tempRectangle.Right - 16, altLine.yAtX(tempRectangle.Right)), false, 0, layerDepth + .01f);
                }
                else
                {
                    slopeTexture.DrawAltPosition(new Vector2(tempRectangle.Left + xTracker, altLine.yAtX(tempRectangle.Left + xTracker)), false, rotation, layerDepth);
                }


                //draws the platform slope texture

                //-------------------------------
                //System.Diagnostics.Debug.WriteLine("slope: " + altLine.getSlope());
                float xTrackerModifier = (float)Math.Abs(Math.Cos(rotation) * 16);
                //System.Diagnostics.Debug.WriteLine(xTrackerModifier);
                if (xTrackerModifier > 16)
                {
                    xTracker += 16;
                }
                else
                {
                    xTracker += xTrackerModifier;
                }
            }

            //------------------------ draw body start -----------------------

            //DRAW PLATFORM BODY BELOW
            xTracker = 0;
            yTracker = 16;

            float startYPos;

            while (xTracker < tempRectangle.Width)
            {
                startYPos = altLine.yAtX(tempRectangle.Left + xTracker);

                if (slope >= 0 && slope < .1)
                {
                }
                else if (slope >= .1 && slope < .2)
                {
                    startYPos -= 1;
                }
                else if (slope >= .2 && slope < .3)
                {
                    startYPos -= 2;
                }
                else if (slope >= .3 && slope < .4)
                {
                    startYPos -= 2;
                }
                else if (slope >= .4 && slope < .5)
                {
                    startYPos -= 4;
                }
                else if (slope >= .6 && slope < .7)
                {
                    startYPos -= 4;
                }

                yTracker = 16;

                while (startYPos <= platformBodyHeight + tempRectangle.Bottom - yTracker)
                {
                    //left side
                    if (xTracker == 0)
                    {
                        //bottom left
                        if (yTracker == 16)
                        {
                            if (collidableOnLeftSide && collidableOnBottom)
                            {
                                slopeTexture.setFrameConfiguration(6, 6, 6);
                            }
                            else if (collidableOnBottom && !collidableOnLeftSide)
                            {
                                slopeTexture.setFrameConfiguration(7, 7, 7);
                            }
                            else if (collidableOnLeftSide && !collidableOnBottom)
                            {
                                slopeTexture.setFrameConfiguration(3, 3, 3);
                            }
                            else
                            {
                                slopeTexture.setFrameConfiguration(4, 4, 4);
                            }
                        }
                        //right side
                        else
                        {
                            if (collidableOnLeftSide)
                            {
                                slopeTexture.setFrameConfiguration(3, 3, 3);
                            }
                            else
                            {
                                slopeTexture.setFrameConfiguration(4, 4, 4);
                            }
                        }
                    }
                    //between left and right side
                    else if (xTracker > 0 && xTracker < tempRectangle.Width - 16 && tempRectangle.Bottom + platformBodyHeight - yTracker > altLine.yAtX(tempRectangle.Left + xTracker + 16))
                    {
                        //bottom
                        if (yTracker == 16)
                        {
                            if (collidableOnBottom)
                            {
                                slopeTexture.setFrameConfiguration(7, 7, 7);
                            }
                            else
                            {
                                slopeTexture.setFrameConfiguration(4, 4, 4);
                            }
                        }
                        //center
                        else
                        {
                            slopeTexture.setFrameConfiguration(4, 4, 4);
                        }
                    }
                    //right side
                    else if (xTracker > tempRectangle.Width - 16)
                    {
                        if (yTracker == 16)
                        {
                            if (collidableOnRightSide && collidableOnBottom)
                            {
                                slopeTexture.setFrameConfiguration(8, 8, 8);
                            }
                            else if (collidableOnBottom && !collidableOnRightSide)
                            {
                                slopeTexture.setFrameConfiguration(7, 7, 7);
                            }
                            else if (collidableOnRightSide && !collidableOnBottom)
                            {
                                slopeTexture.setFrameConfiguration(5, 5, 5);
                            }
                            else
                            {
                                slopeTexture.setFrameConfiguration(4, 4, 4);
                            }
                        }
                        else
                        {
                            if (collidableOnRightSide)
                            {
                                slopeTexture.setFrameConfiguration(5, 5, 5);
                            }
                            else
                            {
                                slopeTexture.setFrameConfiguration(4, 4, 4);
                            }
                        }
                    }
                    if (xTracker > tempRectangle.Width - 16)
                    {
                        slopeTexture.DrawAltPosition(new Vector2(tempRectangle.Right - 16, tempRectangle.Bottom + platformBodyHeight - yTracker), false, 0, layerDepth + .01f);
                    }
                    else
                    {
                        slopeTexture.DrawAltPosition(new Vector2(tempRectangle.Left + xTracker, tempRectangle.Bottom + platformBodyHeight - yTracker), false, 0, layerDepth + .01f);
                    }
                    yTracker += 16;
                }
                xTracker += 16;

                //modifier helps account for slight discrepancies with drawing
                //-------------------------------------------------------------------------draw body end --------------------
            }
        }
        public override void DrawAltPosition(Vector2 altPos)
        {
            int xTracker  = 0;
            int xPosition = (int)altPos.X;
            int yTracker  = 0;
            int yPosition = (int)altPos.Y;

            //expects you to pass in the converted position variable
            yTracker  = 0;
            yPosition = (int)altPos.Y;

            while (yTracker < platformSize.Y)
            {
                xTracker  = 0;
                xPosition = (int)(altPos.X);

                while (xTracker < platformSize.X)
                {
                    if (yTracker == 0)
                    {
                        topWater.DrawAltPosition(new Vector2(xPosition, altPos.Y), flipTopWaterCrest, layerDepth);
                    }
                    else
                    {
                        //left
                        if (yTracker > 0 && yTracker < platformSize.Y - 1 && xTracker == 0)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(3, 3, 3);
                        }
                        //center
                        else if (yTracker > 0 && yTracker < platformSize.Y - 1 && xTracker > 0 && xTracker < platformSize.X - 1)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                        }
                        //right
                        else if (yTracker > 0 && yTracker < platformSize.Y - 1 && xTracker == platformSize.X - 1)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(5, 5, 5);
                        }
                        //bottom left
                        else if (yTracker == platformSize.Y - 1 && xTracker == 0)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(6, 6, 6);
                        }
                        //bottom
                        else if (yTracker == platformSize.Y - 1 && xTracker > 0 && xTracker < platformSize.X - 1)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(7, 7, 7);
                        }
                        //bottom right
                        else if (yTracker == platformSize.Y - 1 && xTracker == platformSize.X - 1)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(8, 8, 8);
                        }

                        completeOutsidePlatformImage.DrawAltPosition(new Vector2(xPosition, yPosition), false, layerDepth);
                    }


                    xPosition += (int)completeOutsidePlatformImage.frameSize.X;
                    xTracker++;
                }
                yTracker++;
                yPosition += (int)(completeOutsidePlatformImage.frameSize.Y);
            }
        }
Ejemplo n.º 10
0
        public virtual void DrawAltPosition(Vector2 altPos)
        {
            int xTracker  = 0;
            int xPosition = (int)altPos.X;
            int yTracker  = 0;
            int yPosition = (int)altPos.Y;

            //expects you to pass in the converted position variable
            yTracker  = 0;
            yPosition = (int)altPos.Y;

            while (yTracker < platformSize.Y)
            {
                xTracker  = 0;
                xPosition = (int)(altPos.X);

                while (xTracker < platformSize.X)
                {
                    //top left
                    if (xTracker == 0 && yTracker == 0)
                    {
                        if (collidableOnLeft)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(0, 0, 0);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(1, 1, 1);
                        }
                    }
                    //top
                    else if (yTracker == 0 && xTracker > 0 && xTracker < platformSize.X - 1)
                    {
                        completeOutsidePlatformImage.setFrameConfiguration(1, 1, 1);
                    }
                    //top right
                    else if (yTracker == 0 && xTracker == platformSize.X - 1)
                    {
                        if (collidableOnRight)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(2, 2, 2);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(1, 1, 1);
                        }
                    }
                    //left
                    else if (yTracker > 0 && yTracker < platformSize.Y - 1 && xTracker == 0)
                    {
                        if (collidableOnLeft)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(3, 3, 3);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                        }
                    }
                    //center
                    else if (yTracker > 0 && yTracker < platformSize.Y - 1 && xTracker > 0 && xTracker < platformSize.X - 2)
                    {
                        completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                    }
                    //right
                    else if (yTracker > 0 && yTracker < platformSize.Y - 1 && xTracker == platformSize.X - 1)
                    {
                        if (collidableOnRight)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(5, 5, 5);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                        }
                    }
                    //bottom left
                    else if (yTracker == platformSize.Y - 1 && xTracker == 0)
                    {
                        if (collidableOnLeft && collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(6, 6, 6);
                        }
                        else if (collidableOnLeft && !collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(3, 3, 3);
                        }
                        else if (!collidableOnLeft && collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(7, 7, 7);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                        }
                    }
                    //bottom
                    else if (yTracker == platformSize.Y - 1 && xTracker > 0 && xTracker < platformSize.X - 1)
                    {
                        if (collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(7, 7, 7);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                        }
                    }
                    //bottom right
                    else if (yTracker == platformSize.Y - 1 && xTracker == platformSize.X - 1)
                    {
                        if (collidableOnRight && collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(8, 8, 8);
                        }
                        else if (collidableOnRight && !collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(5, 5, 5);
                        }
                        else if (!collidableOnRight && collidableOnBottom)
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(7, 7, 7);
                        }
                        else
                        {
                            completeOutsidePlatformImage.setFrameConfiguration(4, 4, 4);
                        }
                    }

                    completeOutsidePlatformImage.DrawAltPosition(new Vector2(xPosition, yPosition), false, layerDepth);

                    xPosition += (int)completeOutsidePlatformImage.frameSize.X;
                    xTracker++;
                }
                yTracker++;
                yPosition += (int)(completeOutsidePlatformImage.frameSize.Y);
            }
        }
Ejemplo n.º 11
0
 public void drawAltPosition(Vector2 altPos)
 {
     bearTrapImage.DrawAltPosition(altPos, false, layerDepth);
 }
Ejemplo n.º 12
0
 public void drawAltPosition(Vector2 altPosition)
 {
     baseTileImage.DrawAltPosition(altPosition);
 }
Ejemplo n.º 13
0
 public void drawAltPosition(Vector2 altPosition)
 {
     baseTileImage.DrawAltPosition(altPosition, false, layerDepth);
 }