Exemplo n.º 1
0
 private void ScrollingBG()
 {
     foreach (Entities.CarLvlBackground BG in entitys)
     {
         //BG.setPosX(1f);
         BG.Update();
     }
 }
Exemplo n.º 2
0
        public void Update(GameTime GameTime, GraphicsDevice Graphics, Hero Hero)
        {
            KeyboardState Current = Keyboard.GetState();

            if (!Current.IsKeyDown(Keys.Right) && !Current.IsKeyDown(Keys.Left))
            {
                Speed     = Vector2.Zero;
                Direction = Vector2.Zero;
            }

            #region Right Movement
            if (Hero.SpritePosition.X < Graphics.Viewport.Width / 2)
            {
                if (Current.IsKeyDown(Keys.Left))
                {
                    Speed.X     = BG_SPEED;
                    Direction.X = MOVE_RIGHT;
                }
            }
            #endregion
            #region Left Movement
            if (Hero.SpritePosition.X > Graphics.Viewport.Width / 4)
            {
                if (Current.IsKeyDown(Keys.Right))
                {
                    Speed.X     = BG_SPEED;
                    Direction.X = MOVE_LEFT;
                }
            }
            #endregion
            #region Later Code

            /*if (true)
             * {
             *  foreach (Sprite BG in VerticalList)
             *  {
             *      BG.Update(GameTime, Speed, Direction);
             *  }
             * }
             * if (true)
             * {
             *  foreach (Sprite BG in VerticalList)
             *  {
             *      BG.Update(GameTime, Speed, Direction);
             *  }
             * }*/

            #endregion

            foreach (Sprite BG in HorizontalList)
            {
                BG.Update(GameTime, Speed, Direction);
            }
        }
Exemplo n.º 3
0
        public void Update()
        {
            Input.Update();

            Camera.Update();

            if (Input.Jump())
            {
                if (Paused)
                {
                    Reset();
                }
                else
                {
                    if (Player.Jump())
                    {
                        JumpSound.Play();
                    }
                }
            }

            if (Paused)
            {
                return;
            }

            BG.Update();
            Road.Update();
            Foreground.Update();

            for (int i = 0; i < Obstacles.Count; i++)
            {
                Obstacles[i].Update();
                if (!Obstacles[i].Active)
                {
                    Obstacles.RemoveAt(i--);
                    score++;
                    Coin.Play();
                }
            }

            Player.Update();

            if (counter++ >= 60)
            {
                AddObstacle();
                counter = 0;
            }

            if (CheckCollisions())
            {
                Die();
            }
        }
Exemplo n.º 4
0
 public override void Update(GameTime gameTime)
 {
     //mPlayer.Update(gameTime, graphicsDevice);
     mPlayer.Update(gameTime);
     BG.Update(gameTime);
 }