示例#1
0
        void b_BrokeBox(object sender, EventArgs e)
        {
            DXBox box = (DXBox)sender;

            Score      += 10 + ComboScore;
            ComboScore += 5;
            DXAnimation anm = null;

            switch (box.Kind)
            {
            case BoxKind.Red: anm = breakingAnimations[0].Clone(); break;

            case BoxKind.Blue: anm = breakingAnimations[1].Clone(); break;

            case BoxKind.Green: anm = breakingAnimations[2].Clone(); break;

            case BoxKind.Yellow: anm = breakingAnimations[3].Clone(); break;

            case BoxKind.Purple: anm = breakingAnimations[4].Clone(); break;

            case BoxKind.Cyan: anm = breakingAnimations[5].Clone(); break;

            case BoxKind.White: anm = breakingAnimations[6].Clone(); break;
            }
            if (anm == null)
            {
                return;
            }
            anm.PosX    = box.PosX - 32f; anm.PosY = box.PosY - 8f;
            anm.Visible = true;
            animations.Add(anm);
        }
示例#2
0
文件: Form1.cs 项目: 471Q/DX_Ball
        /// <summary>
        /// Loads the animations.
        /// </summary>
        private void LoadAnimations()
        {
            DXTiledTexture tiledTextureRedBroke    = new DXTiledTexture(Properties.Resources.redbroke, 5, 4);
            DXTiledTexture tiledTextureBlueBroke   = new DXTiledTexture(Properties.Resources.bluebroke, 5, 4);
            DXTiledTexture tiledTextureGreenBroke  = new DXTiledTexture(Properties.Resources.greenbroke, 5, 4);
            DXTiledTexture tiledTextureYellowBroke = new DXTiledTexture(Properties.Resources.yellowbroke, 5, 4);
            DXTiledTexture tiledTexturePurpleBroke = new DXTiledTexture(Properties.Resources.purplebroke, 5, 4);
            DXTiledTexture tiledTextureCyanBroke   = new DXTiledTexture(Properties.Resources.cyanbroke, 5, 4);
            DXTiledTexture tiledTextureWhiteBroke  = new DXTiledTexture(Properties.Resources.whitebroke, 5, 4);

            breakingAnimations    = new DXAnimation[7];
            breakingAnimations[0] = new DXAnimation(0f, 0f, tiledTextureRedBroke);
            breakingAnimations[1] = new DXAnimation(0f, 0f, tiledTextureBlueBroke);
            breakingAnimations[2] = new DXAnimation(0f, 0f, tiledTextureGreenBroke);
            breakingAnimations[3] = new DXAnimation(0f, 0f, tiledTextureYellowBroke);
            breakingAnimations[4] = new DXAnimation(0f, 0f, tiledTexturePurpleBroke);
            breakingAnimations[5] = new DXAnimation(0f, 0f, tiledTextureCyanBroke);
            breakingAnimations[6] = new DXAnimation(0f, 0f, tiledTextureWhiteBroke);

            int i = 0;

            while (i < 7)
            {
                breakingAnimations[i].AnimationTurned += breakingAnimation_AnimationTurned;
                i++;
            }

            animations = new List <DXAnimation>();
        }
示例#3
0
        public DXAnimation Clone()
        {
            DXAnimation cloned = new DXAnimation(this.posX, this.posY, this.tiledTexture);

            cloned.animationRectangle = new RectangleF(posX, posY, tiledTexture.TileWidth, tiledTexture.TileHeight);
            cloned.AnimationTurned    = this.AnimationTurned;
            return(cloned);
        }
示例#4
0
文件: Form1.cs 项目: 471Q/DX_Ball
        void breakingAnimation_AnimationTurned(object sender, EventArgs e)
        {
            DXAnimation anm = (DXAnimation)sender;

            anm.Visible = false;
        }