Ejemplo n.º 1
0
        /// <summary>
        /// General flow of the game
        /// </summary>
        public override void Update(GameTime gameTime)
        {
            obstacle.Update(gameTime);
            barrel.Update(gameTime);

            //temporary just for testing
            if (test == false)
            {
                if (barrel.hitbox.Intersects(obstacle.hitbox))
                {
                    a    = GetA();
                    test = true;
                }
                else
                {
                    test = false;
                    barrel.Change_Velocity(new Vector2(0, 3));
                }
            }
            else
            {
                if (barrel._position.Y >= obstacle._position.Y + a - obstacle._texture.Height)
                {
                    barrel.Change_Velocity(new Vector2(3, 0));
                    GetA();
                    test = false;
                }
                else
                {
                    barrel.Change_Velocity(new Vector2(0, 3));
                }
            }
        }