Esempio n. 1
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.png");
     splitterSystem = new SplitterSystem(spark);
     camera.setSizeOfField(graphics.GraphicsDevice.Viewport);
     // TODO: use this.Content to load your game content here
 }
Esempio n. 2
0
        protected override void Update(GameTime gameTime)
        {
            float elapsedTimeSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;
            time += elapsedTimeSeconds;
            if (time >= 3)
            {
                splitterSystem = new SplitterSystem(spark);
                time = 0;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.R))
            {
                splitterSystem = new SplitterSystem(spark);
                time = 0;
            }
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();

            foreach (SplitterParticle particle in splitterSystem.particles)
            {
                particle.move((float)gameTime.ElapsedGameTime.TotalSeconds);
            }

            base.Update(gameTime);
        }