Ejemplo n.º 1
0
        private static void torheartshatter(int time, int xpos, int ypos, int maxheight, double horspeed, double vspeed)
        {
            var shatter = new AnimationEvent("sb/torshatter.png", 4, 176);

            storyboard.AddSpriteEvent(shatter);
            shatter.Scale(time, 0.4f);

            if (horspeed > 0)
            {
                //Exit to the right
                shatter.MoveX(time, (int)(time + (2000 - xpos) / horspeed), None, xpos, 2000);
            }
            else
            {
                //Exit to the left
                shatter.MoveX(time, time + (int)(-1.0 * (2000 + xpos) / horspeed), None, xpos, -2000);
            }

            var delay = (ypos - maxheight) / vspeed;

            shatter.MoveY(time, (int)(time + delay), In, ypos, maxheight);
            shatter.MoveY((int)(time + delay), (int)(time + delay + delay), Out, maxheight, ypos);

            delay = time + delay + delay; //Now delay isn't a delay...

            var newvspeed = vspeed * 2;   //Trying to get the maximum speed from easing, is this a parabola?

            //I'm not very good at stuff really. It might be 2x due to derived x squared...

            shatter.MoveY((int)delay, (int)(delay + (1200 - ypos) / newvspeed), None, ypos, 1200);
        }