Beispiel #1
0
        /// <summary>
        /// Make a boom sprite if boomn size == 0 then default size is used
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="boomKind"></param>
        /// <param name="boomSize"></param>
        /// <returns></returns>
        public Sprite3 makeBoom(int x, int y, int boomKind, float boomSize)
        {
            //Texture2DSequence fs = new Texture2DSequence(boomSpriteSheets[boomKind]);
            //fs.setAnimationSequence(frameSeqs[boomKind].firstFrame,frameSeqs[boomKind].lastFrame,frameSeqs[boomKind].ticksBetweenFrames);
            Sprite3         boom = new Sprite3(true, boomImages[boomKind], x, y);
            GCG_SpriteSheet ss   = boomSpriteSheets[boomKind];

            boom.setXframes(ss.getXframes());
            boom.setYframes(ss.getYframes());
            int q = ss.getXframes() * ss.getYframes();

            Vector2[] animSeq = new Vector2[q];
            int       ctr     = 0;

            for (int yy = 0; yy < ss.getYframes(); yy++)
            {
                for (int xx = 0; xx < ss.getXframes(); xx++)
                {
                    animSeq[ctr].X = xx;
                    animSeq[ctr].Y = yy;
                    ctr++;
                }
            }
            boom.setAnimationSequence(animSeq, 0, q - 1, 4);
            //boom.setFrameSource(boomSpriteSheets[boomKind], true);
            if (boomSize > 0)
            {
                boom.setWidthHeight(boomSize, boomSize);
            }
            boom.animationStart();
            //boom.animInfo = fs;
            boom.setAnimFinished(2);
            return(boom);
        }
Beispiel #2
0
        //Texture2DSequence[] frameSeqs = null;

        //Sprite5 boom = null; // for the creation


        public RC_Booms(GraphicsDevice gd, string dir_BoomsImages)
        {
            boomImages     = new Texture2D[numImages];
            boomImages[0]  = Util.texFromFile(gd, dir_BoomsImages + "Boom0.png");
            boomImages[1]  = Util.texFromFile(gd, dir_BoomsImages + "Boom1.png");
            boomImages[2]  = Util.texFromFile(gd, dir_BoomsImages + "Boom2.png");
            boomImages[3]  = Util.texFromFile(gd, dir_BoomsImages + "Boom3.png");
            boomImages[4]  = Util.texFromFile(gd, dir_BoomsImages + "Boom4.png");
            boomImages[5]  = Util.texFromFile(gd, dir_BoomsImages + "Boom5.png");
            boomImages[6]  = Util.texFromFile(gd, dir_BoomsImages + "Boom6.png");
            boomImages[7]  = Util.texFromFile(gd, dir_BoomsImages + "Boom7.png");
            boomImages[8]  = Util.texFromFile(gd, dir_BoomsImages + "Boom8.png");
            boomImages[9]  = Util.texFromFile(gd, dir_BoomsImages + "Boom9.png");
            boomImages[10] = Util.texFromFile(gd, dir_BoomsImages + "Boom10.png");
            boomImages[11] = Util.texFromFile(gd, dir_BoomsImages + "Boom11.png");

            boomSpriteSheets = new GCG_SpriteSheet[numImages];
//          boomSpriteSheets[0] = GCG_SpriteSheet(boomImages[0],XframesZ, YframesZ)
            boomSpriteSheets[0]  = new GCG_SpriteSheet(boomImages[0], 7, 3);
            boomSpriteSheets[1]  = new GCG_SpriteSheet(boomImages[1], 4, 1);
            boomSpriteSheets[2]  = new GCG_SpriteSheet(boomImages[2], 6, 1);
            boomSpriteSheets[3]  = new GCG_SpriteSheet(boomImages[3], 8, 1);
            boomSpriteSheets[4]  = new GCG_SpriteSheet(boomImages[4], 10, 2);
            boomSpriteSheets[5]  = new GCG_SpriteSheet(boomImages[5], 7, 3);
            boomSpriteSheets[6]  = new GCG_SpriteSheet(boomImages[6], 7, 3);
            boomSpriteSheets[7]  = new GCG_SpriteSheet(boomImages[7], 7, 3);
            boomSpriteSheets[8]  = new GCG_SpriteSheet(boomImages[8], 10, 2);
            boomSpriteSheets[9]  = new GCG_SpriteSheet(boomImages[9], 10, 2);
            boomSpriteSheets[10] = new GCG_SpriteSheet(boomImages[10], 7, 2);
            boomSpriteSheets[11] = new GCG_SpriteSheet(boomImages[11], 10, 2);

            //frameSeqs = new Texture2DSequence[numImages];
            //frameSeqs[0] = new Texture2DSequence(boomSpriteSheets[0]);
            //frameSeqs[1] = new Texture2DSequence(boomSpriteSheets[1]);
            //frameSeqs[2] = new Texture2DSequence(boomSpriteSheets[2]);
            //frameSeqs[3] = new Texture2DSequence(boomSpriteSheets[3]);
            //frameSeqs[4] = new Texture2DSequence(boomSpriteSheets[4]);
            //frameSeqs[5] = new Texture2DSequence(boomSpriteSheets[5]);
            //frameSeqs[6] = new Texture2DSequence(boomSpriteSheets[6]);
            //frameSeqs[7] = new Texture2DSequence(boomSpriteSheets[7]);
            //frameSeqs[8] = new Texture2DSequence(boomSpriteSheets[8]);
            //frameSeqs[9] = new Texture2DSequence(boomSpriteSheets[9]);
            //frameSeqs[10] = new Texture2DSequence(boomSpriteSheets[10]);
            //frameSeqs[11] = new Texture2DSequence(boomSpriteSheets[11]);

            //frameSeqs[0].setAnimationSequence(0, 19, 2);
            //frameSeqs[1].setAnimationSequence(0, 3, 5);
            //frameSeqs[2].setAnimationSequence(0, 5, 4);

            //frameSeqs[0].setAnimationSequence(0, 14, 4);
            //frameSeqs[1].setAnimationSequence(0, 3, 8);
            //frameSeqs[2].setAnimationSequence(0, 5, 6);
            //frameSeqs[3].setAnimationSequence(0, 7, 6);
            //frameSeqs[4].setAnimationSequence(0, 19, 3);
            //frameSeqs[5].setAnimationSequence(0, 14, 4);
            //frameSeqs[6].setAnimationSequence(0, 20, 3);
            //frameSeqs[7].setAnimationSequence(0, 20, 3);
            //frameSeqs[8].setAnimationSequence(0, 19, 3);
            //frameSeqs[9].setAnimationSequence(0, 19, 3);
            //frameSeqs[10].setAnimationSequence(0, 13, 4);
            //frameSeqs[11].setAnimationSequence(0, 19, 3);
        }