Ejemplo n.º 1
0
        public void Draw(SpriteBatch spriteBatch, Camera cam, float elapsedTime)
        {
            goneTime += elapsedTime;
            if(goneTime >= explosionTime)
            {
                goneTime = 0;
            }

            float animatedTime = goneTime / explosionTime;

            frame = (int)(numberOfFrames * animatedTime);
            frameX = frame / xFrames;
            frameY = frame % yFrames;

            spriteBatch.Draw(explosionTexture, cam.getScreenCord(new Vector2(0.5f, 0.5f)),
                new Rectangle((int)(expWidth * frameX), (int)(expHeight * frameY), (int)expWidth, (int)expHeight),
                Color.White, 0, new Vector2(expWidth / 2, expHeight / 2), scale, SpriteEffects.None, 0);
        }
Ejemplo n.º 2
0
        public void Draw(SpriteBatch spriteBatch, Camera cam, float elapsedTime)
        {
            scale = cam.getScale(0.7f, explosionTexture.Bounds.Width);
            goneTime += elapsedTime;
            if (goneTime >= explosionTime)
            {
                goneTime = 2; // time between explosion
            }
            float animatedTime = goneTime / explosionTime;

            // calc for the imageAnimation
            frame = (int)(animatedTime * numberOfFrames);
            frameX = frame % xframes;
            frameY = frame / xframes;

            // draw the explosion in center
            spriteBatch.Draw(explosionTexture, cam.getScreenCord(new Vector2(1.0f, 1.0f)),
                new Rectangle((int)(expWidth * frameX), (int)(expHeight * frameY), (int)expWidth, (int)expHeight),
                Color.White, 0, new Vector2(expWidth / 2, expHeight / 2), scale, SpriteEffects.None, 0);
        }
Ejemplo n.º 3
0
        // draw
        internal void Draw(SpriteBatch spriteBatch, Camera camera, Texture2D particleTexture)
        {
            //Rectangle sparkRectangleTexture = camera.getRectangle(position.X, position.Y);

            spriteBatch.Draw(particleTexture, camera.getScreenCord(position), null, null, null, 2, Vector2.One * camera.getScale(particleTexture.Width, 0.025f), Color.White,SpriteEffects.None, 0);
        }