Beispiel #1
0
        public override void Update(GameTime gameTime)
        {
            this.X    += this.GameScreen.GameBackground.HorizontalSpeed;
            _rectangle = new Rectangle((int)this.X, (int)this.Y, this._width, this._height);

            if (this.IsVisible && _rectangle.Intersects(this.GameScreen.GameCharacter.YellowRed))
            {
                CheckVerticalCollision(this.GameScreen.GameCharacter.TopBody, GameScreen.GameCharacter.BottomBody);
                CheckSideCollision(this.GameScreen.GameCharacter.LeftSide, GameScreen.GameCharacter.RightSide);
            }

            if (this.X < this.GameScreen.GameCharacter.X - 400)
            {
                this.IsVisible = false;
                _elements.RemoveElement(this);
            }
            else if (this.X > this.GameScreen.GameCharacter.X + 1300)
            {
                this.IsVisible = false;
            }
            else
            {
                this.IsVisible = true;
            }

            this._animation.Update(8);
        }
Beispiel #2
0
        public override void Update(GameTime gameTime)
        {
            this.X        += this.GameScreen.GameBackground.HorizontalSpeed;
            this.Rectangle = new Rectangle((int)this.X, (int)this.Y, this._width, this._height);

            if (this.X < this.GameScreen.GameCharacter.X - 400)
            {
                this.IsVisible = false;
                _elements.RemoveElement(this);
            }
            else if (this.X > this.GameScreen.GameCharacter.X + 1300)
            {
                this.IsVisible = false;
            }
            else
            {
                this.IsVisible = true;
            }
        }