Ejemplo n.º 1
0
        public ExplosionView(Camera camera, SpriteBatch spriteBatch, Vector2 startLocation, float componentsSize, Texture2D splitterTexture, Texture2D splitterSecondTexture, Texture2D smokeTexture, Texture2D explosionTexture, Texture2D shockwaveTexture)
        {
            _camera = camera;
            _spriteBatch = spriteBatch;

            splitterSystem = new SplitterSystem(splitterTexture, splitterSecondTexture, _spriteBatch, _camera, componentsSize, startLocation);
            smokeSystem = new SmokeSystem(smokeTexture, componentsSize, startLocation);
            explosion = new Explosion2d(_spriteBatch, explosionTexture, _camera, componentsSize, startLocation);
            shockwave = new shockwave(_spriteBatch, shockwaveTexture, _camera, componentsSize, startLocation);
        }
Ejemplo n.º 2
0
 public GameView(Texture2D spark, Texture2D smoke, Texture2D explosion, Rectangle gameWindow, Vector2 startPosition)
 {
     this.spark = spark;
     this.smoke = smoke;
     this.explosion = explosion;
     this.gameWindow = gameWindow;
     this.startPosition = startPosition;
     sparkSystem = new SparkSystem(startPosition);
     smokeSystem = new SmokeSystem(startPosition);
     explosionSystem = new ExplosionSystem(startPosition);
 }
Ejemplo n.º 3
0
 public GameController(Texture2D spark, Texture2D smoke, Texture2D explosion, Rectangle gameWindow, Vector2 startPosition)
 {
     this.spark         = spark;
     this.smoke         = smoke;
     this.explosion     = explosion;
     this.gameWindow    = gameWindow;
     this.startPosition = startPosition;
     sparkSystem        = new SparkSystem(startPosition);
     smokeSystem        = new SmokeSystem(startPosition);
     explosionSystem    = new ExplosionSystem(startPosition);
 }
Ejemplo n.º 4
0
 public ApplicationView(Texture2D smokeTexture, Texture2D splitterTexture, Texture2D explosionTexture, Texture2D shockwaveTexture, Camera camera, SpriteBatch spriteBatch)
 {
     _smokeTexture = smokeTexture;
     _splitterTexture = splitterTexture;
     _explosionTexture = explosionTexture;
     _shockwaveTexture = shockwaveTexture;
     _camera = camera;
     _spriteBatch = spriteBatch;
     explosion = new Explosion(_explosionTexture, _camera);
     smokeSystem = new SmokeSystem(_smokeTexture, explosionPos);
     splitterSystem = new SplitterSystem(_splitterTexture, explosionPos);
 }
Ejemplo n.º 5
0
 public GameController(Texture2D spark, Texture2D smoke, Texture2D explosion, Rectangle gameWindow,
                       Vector2 startPosition, SpriteBatch spriteBatch, Camera camera, SoundEffect explosionSound)
 {
     this.spark          = spark;
     this.smoke          = smoke;
     this.explosion      = explosion;
     this.gameWindow     = gameWindow;
     this.startPosition  = startPosition;
     this.spriteBatch    = spriteBatch;
     this.camera         = camera;
     this.explosionSound = explosionSound;
     sparkSystem         = new SparkSystem(startPosition);
     smokeSystem         = new SmokeSystem(startPosition);
     explosionSystem     = new ExplosionSystem(startPosition, explosionSound);
 }
Ejemplo n.º 6
0
        /// <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);
            Smoke = Content.Load<Texture2D>("particlesmokee.png");
            smokesystem = new SmokeSystem(Smoke);
            camera = new Camera();
            camera.ScaleEverything(graphics.GraphicsDevice.Viewport);
            graphics.PreferredBackBufferHeight = 500;
            graphics.PreferredBackBufferWidth = 500;
            graphics.ApplyChanges();

            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 7
0
        /// <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);
            spark       = Content.Load <Texture2D>("spark");
            smoke       = Content.Load <Texture2D>("particlesmoke");
            explosion   = Content.Load <Texture2D>("explosion");
            fireSound   = Content.Load <SoundEffect>("firesound.wav");
            camera      = new Camera(graphics.GraphicsDevice.Viewport);
            Vector2 startPosition = new Vector2(0.5f, 0.5f);

            gameWindow  = camera.GetGameWindow();
            gameView    = new GameController(spark, smoke, explosion, gameWindow, startPosition, spriteBatch, camera, fireSound);
            smokeSystem = new SmokeSystem();

            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 8
0
        public void Click(Vector2 mousePosition)
        {
            Vector2 logicalMousePosition = camera.convertToLogicalCoords(mousePosition.X, mousePosition.Y);

            if (logicalMousePosition.X <= 100f && logicalMousePosition.X >= 0f && logicalMousePosition.Y <= 100f && logicalMousePosition.Y >= 0f)
            {
                ballSimulation.setDeadBalls(logicalMousePosition.X, logicalMousePosition.Y, radius);      //om jag sätter *100 här så får musen rätt position!
                particleSpark.Add(particleSystem = new ParticleSystem(logicalMousePosition));
                smokes.Add(smokeSystem           = new SmokeSystem(smoke, logicalMousePosition, camera)); //får inte denna att fungera
                explosions.Add(explosionManager  = new ExplosionManager(spriteBatch, bangExplosion, camera, logicalMousePosition));
                //foreach (Ball ball in ballSimulation.RecentlyKilledBalls)
                //{
                //    smokes.Add(new SmokeSystem(smoke, ball.position, camera));
                //}
            }
            //explosionManager.PlayExplosionSound();
            soundEffect.Play();
        }
Ejemplo n.º 9
0
        public ExplosionView(ContentManager content, Camera camera, SpriteBatch spriteBatch, Vector2 startLocation, float scale)
        {
            _content = content;
            _camera = camera;
            _spriteBatch = spriteBatch;

            splitterSecondTexture = _content.Load<Texture2D>("Spark2");
            splitterTexture = _content.Load<Texture2D>("Spark3");
            splitterSystem = new SplitterSystem(splitterTexture, splitterSecondTexture, _spriteBatch, _camera, scale, startLocation);

            smokeTexture = _content.Load<Texture2D>("Smoketest");
            smokeSystem = new SmokeSystem(smokeTexture, scale, startLocation);

            explosionTexture = _content.Load<Texture2D>("Fixforshittyschoolcomputer");
            explosion = new Explosion2d(_spriteBatch, explosionTexture, _camera, scale, startLocation);

            shockwaveTexture = _content.Load<Texture2D>("Shockwave2");
            shockwave = new shockwave(_spriteBatch, shockwaveTexture, _camera, scale, startLocation);
        }
Ejemplo n.º 10
0
        /// <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);
            spark       = Content.Load <Texture2D>("spark");
            smoke       = Content.Load <Texture2D>("particlesmoke");
            explosion   = Content.Load <Texture2D>("explosion");
            //Vector2 startPosition = new Vector2(graphics.GraphicsDevice.Viewport.Bounds.Width / 2.0f, graphics.GraphicsDevice.Viewport.Bounds.Height / 2.0f);
            camera = new Camera(graphics.GraphicsDevice.Viewport);
            Vector2 startPosition = new Vector2(0.5f, 0.5f);

            gameWindow = camera.GetGameWindow();
            gameView   = new GameController(spark, smoke, explosion, gameWindow, startPosition);
            ss         = new SmokeSystem();
            gameView.Initiate();


            // TODO: use this.Content to load your game content here
        }
        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;
        }
Ejemplo n.º 12
0
        /// <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
        }
Ejemplo n.º 13
0
        //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;
        }
        public void Click(Vector2 mousePosition)
        {
            Vector2 logicalMousePosition = camera.convertToLogicalCoords(mousePosition.X, mousePosition.Y);

            if (logicalMousePosition.X <= 100f && logicalMousePosition.X >= 0f && logicalMousePosition.Y <= 100f && logicalMousePosition.Y >= 0f)
            {
                ballSimulation.setDeadBalls(logicalMousePosition.X, logicalMousePosition.Y, radius);//om jag sätter *100 här så får musen rätt position!
                particleSpark.Add(particleSystem = new ParticleSystem(logicalMousePosition));
                smokes.Add(smokeSystem = new SmokeSystem(smoke, logicalMousePosition, camera));//får inte denna att fungera
                explosions.Add(explosionManager = new ExplosionManager(spriteBatch, bangExplosion, camera, logicalMousePosition));
                //foreach (Ball ball in ballSimulation.RecentlyKilledBalls)
                //{
                //    smokes.Add(new SmokeSystem(smoke, ball.position, camera));
                //}
            }
            //explosionManager.PlayExplosionSound();
            soundEffect.Play();
        }
Ejemplo n.º 15
0
 public void Initiate()
 {
     sparkSystem = new SparkSystem(startPosition);
     smokeSystem = new SmokeSystem(startPosition);
     explosionSystem = new ExplosionSystem(startPosition);
 }
        /// <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
        }
Ejemplo n.º 17
0
 public void Initiate()
 {
     sparkSystem     = new SparkSystem(startPosition);
     smokeSystem     = new SmokeSystem(startPosition);
     explosionSystem = new ExplosionSystem(startPosition);
 }
Ejemplo n.º 18
0
 public void createExplosion()
 {
     explosion = new Explosion(_explosionTexture, _camera);
     smokeSystem = new SmokeSystem(_smokeTexture, explosionPos);
     splitterSystem = new SplitterSystem(_splitterTexture, explosionPos);
 }
Ejemplo n.º 19
0
        /// <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);
            spark = Content.Load<Texture2D>("spark");
            smoke = Content.Load<Texture2D>("particlesmoke");
            explosion = Content.Load<Texture2D>("explosion");
            //Vector2 startPosition = new Vector2(graphics.GraphicsDevice.Viewport.Bounds.Width / 2.0f, graphics.GraphicsDevice.Viewport.Bounds.Height / 2.0f);
            camera = new Camera(graphics.GraphicsDevice.Viewport);
            Vector2 startPosition = new Vector2(0.5f, 0.5f);
            gameWindow = camera.GetGameWindow();
            gameView = new GameView(spark, smoke, explosion, gameWindow, startPosition);
             ss = new SmokeSystem();
             gameView.Initiate();

            // TODO: use this.Content to load your game content here
        }