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");
            camera.ScaleEverything(graphics.GraphicsDevice.Viewport);
               splittersystem = new SplitterSystem(spark);

            // TODO: use this.Content to load your game content here
        }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();

            // convert form double to float
            // TODO: Add your update logic here
            // updatera tiden från update

            if(Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                float elapsedTimeSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;
                time += elapsedTimeSeconds;
                if (time >= 3)
                {

                    //splittersystem = new SplitterSystem(spark);
                    time = 0;
                }

                if(Keyboard.GetState().IsKeyDown(Keys.Space))
                {
                    splittersystem = new SplitterSystem(spark);    // complementing * forgot to put a manual explosion

                }
            }

            //foreach (SplitterParticle splitter in splittersystem.particles)
            //{
               // splittersystem.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
            //}

            base.Update(gameTime);
        }