Example #1
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     Color color = new Color(fade, fade, fade, fade);
     float scale = camera.getTextureScale(_smokeTexture.Width, size);
     spriteBatch.Draw(_smokeTexture, camera.getVisualCoords(position, _smokeTexture.Width, _smokeTexture.Height, scale), null,
                         color, rotation, randomDirection, scale, SpriteEffects.None, 0.3f);
 }
Example #2
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     foreach (SmokeParticle smokeParticle in smokeList)
     {
         smokeParticle.Draw(spriteBatch, camera);
     }
 }
Example #3
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     foreach (SplitterParticle splitterParticle in particleArray)
     {
         splitterParticle.Draw(spriteBatch, camera);
     }
 }
Example #4
0
 public void Draw(SpriteBatch spriteBatch, Camera camera)
 {
     float scale = camera.getTextureScale(_splitterTexture.Width, particleSize);
     Color color = new Color(fade, fade, fade, fade);
     spriteBatch.Draw(_splitterTexture,
                     camera.getVisualCoords(position, _splitterTexture.Width, _splitterTexture.Height, scale),
                     null, color, 0, randomDirection, scale, SpriteEffects.None, 0.4f);
 }
Example #5
0
        public Explosion(Texture2D explosionTexture, Camera camera, Vector2 mousePosition)
        {
            _explosionTexture = explosionTexture;
            _camera = camera;
            _mousePosition = mousePosition;
            timeElapsed = 0;

            frameWidth = _explosionTexture.Width / numFramesX;
            frameHeight = _explosionTexture.Height / numFramesY;
        }
Example #6
0
        public void Draw(SpriteBatch spriteBatch, Texture2D _circleAimTexture, Camera _camera)
        {
            float aimScale = _camera.getTextureScale(_circleAimTexture.Width, size);
            mousePosition = _camera.getLogicalCoords(new Vector2(_mouseState.X, _mouseState.Y));

            spriteBatch.Begin(SpriteSortMode.FrontToBack);
            spriteBatch.Draw(_circleAimTexture, _camera.getVisualCoords(mousePosition, _circleAimTexture.Width, _circleAimTexture.Height, aimScale),
                        _circleAimTexture.Bounds, Color.White, 0,
                        new Vector2(aimScale, aimScale),
                        aimScale, SpriteEffects.None, 0.6f);
            spriteBatch.End();
        }
        /// en konstruktor som laddar in först i klassen!
        public BallView(GraphicsDeviceManager graphics, BallSimulation BallSimulation, ContentManager Content, Texture2D Ball, Texture2D deadBall)
        {
            ballTexture = Ball;///laddar in bollen //detta görs bara en gång!
            this.deadBall = deadBall;
            box = new Texture2D(graphics.GraphicsDevice, 1, 1);///denna skapar en box
            box.SetData(new Color[]
            {
                Color.Black
            });/// denna sätter vilken färg!

            camera = new Camera(graphics.GraphicsDevice.Viewport);/// skapar en ny camera instans
            ballSimulation = BallSimulation;
        }
Example #8
0
        //Vector2 explosionPos = new Vector2(0.5f, 0.5f);
        public ExplosionView(Texture2D smokeTexture, Texture2D splitterTexture, Texture2D explosionTexture, 
                                Texture2D shockwaveTexture, Camera camera, SpriteBatch spriteBatch, 
                                SoundEffect fireSound)
        {
            _smokeTexture = smokeTexture;
            _splitterTexture = splitterTexture;
            _explosionTexture = explosionTexture;
            _shockwaveTexture = shockwaveTexture;
            _camera = camera;
            _spriteBatch = spriteBatch;
            _fireSound = fireSound;

            createExplosion();
        }
        Vector2 startposition = new Vector2(1f, 1f); // hela planen är just nu 100*100// så denna börjar i mitten 50*50

        #endregion Fields

        #region Constructors

        //BallView ballview;
        public Explosion(SpriteBatch spritebatch, Texture2D Particle, Camera Camera, Texture2D Smoke, Texture2D BangExplosion, SoundEffect explosionSound, Texture2D CursorImage, BallSimulation bs)
        {
            timeElapsed = 0; //denna ska vara 0 när programmet startas
                             //ballview = Ballview;
            //this.masterBallDead = masterBallDead;
            cursorImage = CursorImage;
            //cursorPos = CursorPosition;

            camera = Camera;//så jag kan använda kameran i klassen!
            spriteBatch = spritebatch;
            particle = Particle;

            bangExplosion = BangExplosion;
            smoke = Smoke;
            Width = particle.Width; // posFramesX; //delar explosionens bredd med positions framesen!
            Height = particle.Height; // posFramesY;
            soundEffect = explosionSound;

            particleSystem = new ParticleSystem(startposition);
            smokeSystem = new SmokeSystem(smoke, startposition, camera);//får inte denna att fungera
            explosionManager = new ExplosionManager(spriteBatch, BangExplosion, camera, startposition);
            ballSimulation = bs;
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            camera = new Camera(graphics.GraphicsDevice.Viewport);

            Texture2D smokee = Content.Load<Texture2D>("particlesmokee");
            Texture2D spark = Content.Load<Texture2D>("spark");
            Texture2D bangExplosion = Content.Load<Texture2D>("explosion");
            Texture2D masterBall = Content.Load<Texture2D>("master_ball");
            Texture2D masterBallDead = Content.Load<Texture2D>("master_ball_dead2");
            cursorImage = Content.Load<Texture2D>("Pointer");
            SoundEffect explosionSound = Content.Load<SoundEffect>("firesound");

            Vector2 startPosition = new Vector2(0.5f, 0.5f);
            ballSimulation = new BallSimulation();
            explosion = new Explosion(spriteBatch, spark, camera, smokee, bangExplosion, explosionSound, cursorImage, ballSimulation);
            smokeSystem = new SmokeSystem(smokee, startPosition, camera);
            ballview = new BallView(graphics, ballSimulation, Content, masterBall, masterBallDead);
            // TODO: use this.Content to load your game content here
        }