public override List <Image> GetImages(Size imageSize, Color backColor, ImageBoundry boundry)
        {
            images         = new List <Image>();
            this.imageSize = imageSize;

            float centerX = imageSize.Width / 2;
            float centerY = imageSize.Height / 2;

            //Start with all points at the center
            PointF point1 = new PointF(centerX, centerY);
            PointF point2 = new PointF(centerX, centerY);
            PointF point3 = new PointF(centerX, centerY);
            PointF point4 = new PointF(centerX, centerY);

            for (int i = 0; i < 10; i++)
            {
                AddImage(point1, point2, point3, point4);
            }
            //Fan out into a square

            point1.X -= 30f;
            point1.Y -= 30f;
            point2.X += 30f;
            point2.Y -= 30f;
            point3.X += 30f;
            point3.Y += 30f;
            point4.X -= 30f;
            point4.Y += 30f;

            for (int i = 0; i < 10; i++)
            {
                AddImage(point1, point2, point3, point4);
            }
            //Round out into a circle

            return(images);
        }
Exemple #2
0
        public override List <Image> GetImages(Size imageSize, Color backColor, ImageBoundry boundry)
        {
            this.imageSize = imageSize;
            this.backColor = backColor;
            images         = new List <Image>();

            /*
             * The ball should start at center screen. Then it should go up for 10 frames, then back down for 10 frames
             * The ball should flatten and get more oblong when it hits the ground
             */

            float circleSize = boundry.ImageSize.Width * .05f;
            float midScreenX = boundry.Center.X;
            float lineY      = boundry.Center.Y;
            int   ballCount  = 4;
            float lineSize   = boundry.ImageSize.Width * .8f;

            int changeFrameCount = 5;


            float startingX = (boundry.Center.X - (boundry.ImageSize.Width / 2)) +
                              (boundry.ImageSize.Width - lineSize);

            startingX -= (circleSize / 2);
            float distance = lineSize / ballCount;

            float ballStartY = lineY - (circleSize / 2f);

            /*
             * Start all of the balls in 1 line
             */
            #region Create Ball Objects
            BallInfo ball1 = new BallInfo()
            {
                X         = startingX,
                Y         = ballStartY,
                Height    = circleSize,
                Width     = circleSize,
                BallColor = Color.Red
            };

            BallInfo ball2 = new BallInfo()
            {
                X         = ball1.X + distance,
                Y         = ballStartY,
                Height    = circleSize,
                Width     = circleSize,
                BallColor = Color.Blue
            };

            BallInfo ball3 = new BallInfo()
            {
                X         = ball2.X + distance,
                Y         = ballStartY,
                Height    = circleSize,
                Width     = circleSize,
                BallColor = Color.Green
            };

            BallInfo ball4 = new BallInfo()
            {
                X         = ball3.X + distance,
                Y         = ballStartY,
                Height    = circleSize,
                Width     = circleSize,
                BallColor = Color.Yellow
            };
            #endregion

            for (int i = 0; i < changeFrameCount * 3; i++)
            {
                AddImage(ball1, ball2, ball3, ball4);
            }

            //Twitch slightly before moving
            for (int i = 0; i < 2; i++)
            {
                ball1.X += .5f;
                ball1.Y -= .5f;

                ball2.X -= .5f;
                ball2.Y += .5f;

                ball3.X += .5f;
                ball3.Y -= .5f;

                ball4.X -= .5f;
                ball4.Y += .5f;

                AddImage(ball1, ball2, ball3, ball4);

                ball1.X -= .5f;
                ball1.Y += .5f;

                ball2.X += .5f;
                ball2.Y -= .5f;

                ball3.X -= .5f;
                ball3.Y += .5f;

                ball4.X += .5f;
                ball4.Y -= .5f;

                AddImage(ball1, ball2, ball3, ball4);
            }

            //Final Position
            //Ball 1 and 3 should be right above the center line and side by side
            //Ball 2 should not move
            //Ball 4 should be right by Ball 2, directly under ball 3

            float ball1XFinal = startingX + distance;
            float ball1YFinal = lineY - circleSize * 2;
            float ball3XFinal = startingX + distance + (distance / 2);
            float ball3YFinal = lineY - circleSize * 2;
            float ball4XFinal = startingX + distance + (distance / 2);
            float ball4YFinal = ballStartY;

            float xChange1 = (ball1XFinal - ball1.X) / changeFrameCount;
            float yChange1 = (ball1.Y - ball1YFinal) / changeFrameCount;
            float xChange3 = (ball3XFinal - ball3.X) / changeFrameCount;
            float yChange3 = (ball3.Y - ball3YFinal) / changeFrameCount;
            float xChange4 = (ball4XFinal - ball4.X) / changeFrameCount;
            float yChange4 = (ball4.Y - ball4YFinal) / changeFrameCount;


            for (int i = 0; i < changeFrameCount; i++)
            {
                ball1.X += xChange1;
                ball1.Y -= yChange1;

                ball3.X += xChange3;
                ball3.Y -= yChange3;

                ball4.X += xChange4;
                ball4.Y -= yChange4;
                AddImage(ball1, ball2, ball3, ball4);
            }

            //Hold here
            for (int i = 0; i < changeFrameCount * 3; i++)
            {
                AddImage(ball1, ball2, ball3, ball4);
            }

            //Twitch slightly before moving
            for (int i = 0; i < 2; i++)
            {
                ball1.X += .5f;
                ball1.Y -= .5f;

                ball2.X -= .5f;
                ball2.Y += .5f;

                ball3.X += .5f;
                ball3.Y -= .5f;

                ball4.X -= .5f;
                ball4.Y += .5f;

                AddImage(ball1, ball2, ball3, ball4);

                ball1.X -= .5f;
                ball1.Y += .5f;

                ball2.X += .5f;
                ball2.Y -= .5f;

                ball3.X -= .5f;
                ball3.Y += .5f;

                ball4.X += .5f;
                ball4.Y -= .5f;

                AddImage(ball1, ball2, ball3, ball4);
            }

            //Change back to a line
            for (int i = 0; i < changeFrameCount; i++)
            {
                ball1.X -= xChange1;
                ball1.Y += yChange1;

                ball3.X -= xChange3;
                ball3.Y += yChange3;

                ball4.X -= xChange4;
                ball4.Y += yChange4;
                AddImage(ball1, ball2, ball3, ball4);
            }
            return(images);
        }
Exemple #3
0
        public override List <Image> GetImages(Size imageSize, Color backColor, ImageBoundry boundry)
        {
            this.imageSize = imageSize;
            this.backColor = backColor;
            this.boundry   = boundry;

            /*
             * The ball should start at center screen. Then it should go up for 10 frames,
             * then back down for 10 frames
             * The ball should flatten and get more oblong when it hits the ground
             */

            float circleSize = boundry.ImageSize.Width * .05f;

            float startPointY = boundry.Center.Y - (boundry.ImageSize.Height / 2);
            float x           = (boundry.Center.X) - (circleSize / 2f);
            float midScreenY  = (boundry.Center.Y) - (circleSize / 2f);
            float increment   = ((midScreenY - startPointY) - (circleSize * .5f)) / 10;

            startPointY += increment;

            float width  = circleSize;
            float height = circleSize;

            images = new List <Image>();
            //Add starting ball
            AddImage(x, startPointY, width, height);

            //Add images going down
            float y = startPointY;

            for (int i = 0; i < 9; i++)
            {
                y += increment;
                AddImage(x, y, width, height);
            }

            /*
             * Add Bouncing images
             * When the ball comes in contact with the line is should start to squish/flatten slightly to
             * show that pressure is being put on the ball as it's velocity and momentum try to push it further down.
             * The ball should unsquish as it recoils back up.
             *
             * Without the squish the animiation will just show the ball going straight up and down
             */
            //Squish Down
            float SquishWidth  = width;
            float squishHeight = height;

            for (int i = 0; i < 2; i++)
            {
                squishHeight *= .85f;
                SquishWidth  *= 1.15f;
                x            -= .1f;
                y            += (increment * .25f);
                AddImage(x, y, SquishWidth, squishHeight);
            }

            //Unsquish
            for (int i = 0; i < 2; i++)
            {
                squishHeight *= 1.15f;
                SquishWidth  *= .85f;
                x            += .1f;
                y            -= increment;
                AddImage(x, y, SquishWidth, squishHeight);
            }
            //Add Images Going up
            for (int i = 0; i < 8; i++)
            {
                y -= increment;
                AddImage(x, y, width, height);
            }

            return(images);
        }
 public abstract List <Image> GetImages(Size imageSize, Color backColor, ImageBoundry boundry);