Ejemplo n.º 1
0
        private void DrawGround(Ground ground)
        {
            BasicGraphics.SetColor(0.22f, 0.13f, 0.11f);

            Vector2 v1 = new Vector2(ground.LeftX, ground.TopY);
            Vector2 v2 = new Vector2(ground.RightX, ground.TopY - 99999f);

            DrawSquare(v1, v2);

            DrawGround2(ground);
        }
Ejemplo n.º 2
0
        private void DrawProjectile(Vector2 projectilePosition)
        {
            BasicGraphics.SetColor(DangerColor);

            float x = projectilePosition.X;
            float y = projectilePosition.Y;
            float h = VisualValues.HalfProjectileWidthHeight;

            Vector2 v1 = new Vector2(x - h, y + h);
            Vector2 v2 = new Vector2(x + h, y - h);

            DrawSquare(v1, v2);
        }
Ejemplo n.º 3
0
        private void DrawObstacle(Obstacle obstacle)
        {
            BasicGraphics.SetColor(DangerColor);

            DrawSquare(obstacle.TopLeftCorner, obstacle.BottomRightCorner);
        }
Ejemplo n.º 4
0
        private void DrawGround2(Ground ground)
        {
            float groundPartWidth     = 2.4f;
            float groundMinimumHeight = 0.1f;
            float triangleYOffset     = 0.05f;

            float leftYOffset  = triangleYOffset;
            float rightYOffset = 0;

            float topY = ground.TopY;

            float leftX     = ground.LeftX;
            float maxRightX = ground.RightX;

            BasicGraphics.SetColor(0.2f, 0.74f, 0.33f);

            while (leftX < maxRightX)
            {
                if (IsCoordRightOfScreen(leftX))
                {
                    break;
                }

                leftYOffset  = leftYOffset > 0 ? 0 : triangleYOffset;
                rightYOffset = rightYOffset > 0 ? 0 : triangleYOffset;

                float fullRightX = leftX + groundPartWidth;

                if (IsCoordLeftOfScreen(fullRightX))
                {
                    leftX = fullRightX;
                    continue;
                }

                Vector2 topLeftCorner    = new Vector2(leftX, topY);
                Vector2 bottomLeftCorner = new Vector2(leftX, topY - groundMinimumHeight - leftYOffset);

                Vector2 topRightCorner;
                Vector2 bottomRightCorner;

                if (fullRightX < maxRightX)
                {
                    topRightCorner    = new Vector2(fullRightX, topY);
                    bottomRightCorner = new Vector2(fullRightX, topY - groundMinimumHeight - rightYOffset);
                }
                else
                {
                    topRightCorner = new Vector2(maxRightX, topY);

                    bottomRightCorner = new Vector2(maxRightX, (topY - groundMinimumHeight - rightYOffset));
                }

                topLeftCorner     = GetTransformedVector(topLeftCorner);
                topRightCorner    = GetTransformedVector(topRightCorner);
                bottomLeftCorner  = GetTransformedVector(bottomLeftCorner);
                bottomRightCorner = GetTransformedVector(bottomRightCorner);

                BasicGraphics.DrawQuad(topLeftCorner, topRightCorner, bottomLeftCorner, bottomRightCorner);

                leftX = fullRightX;
            }
        }
Ejemplo n.º 5
0
        //
        // LEVELELEMENTS
        //

        private void DrawBackground(LevelProgression levelProgression)
        {
            BasicGraphics.SetColor(0.4f, 0.8f, 1.0f);

            DrawSquare(new Vector2(-2.1f, 1.1f), new Vector2(2.1f, -1.1f), false);
        }