Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            if (_isFalling)
            {
                Body.ApplyForce(new Vector2(0, 0.001f));
                return;
            }

            if (IsEaten)
            {
                Body.Stop();
                return;
            }

            _rotationAngle += Body.GetVelocity().X / 10;
            _rotationAngle %= MathHelper.Pi * 2;

            Body.Hikuah(0.08f);

            if (GetPosition().X > CowGameScreen.Graphics.PreferredBackBufferWidth && CowGameScreen.WorldOnFocus.RightWorld != null)
            {
                CowGameScreen.ChangeWorld(this, Direction.Right);
            }

            if (GetPosition().X + GetPosition().Width < 0 && CowGameScreen.WorldOnFocus.LeftWorld != null)
            {
                CowGameScreen.ChangeWorld(this, Direction.Left);
            }
        }
Exemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            if (StarvePoint <= 0)
            {
                HealthPoint -= 0.03f;
            }

            if (HealthPoint <= 0)
            {
                CowGameScreen.FinishGame();
            }

            KeyboardState ks = Keyboard.GetState();

            HandleUserAgent(gameTime, ks);
            HandleInventory();
            HandleInteractables(ks);
            HandleAttackable(ks);
            base.Update(gameTime);

            if (GetCenterPosition().X > CowGameScreen.Graphics.PreferredBackBufferWidth && CowGameScreen.WorldOnFocus.RightWorld != null)
            {
                CowGameScreen.ChangeWorld(this, Direction.Right);
            }

            if (GetCenterPosition().X < 0 && CowGameScreen.WorldOnFocus.LeftWorld != null)
            {
                CowGameScreen.ChangeWorld(this, Direction.Left);
            }

            _prevKeyState = ks;
        }
Exemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            Body.Hikuah(12);
            SourceRect = ItemMovement.Animate(gameTime);
            if (GetPosition().X > CowGameScreen.Graphics.PreferredBackBufferWidth && CowGameScreen.WorldOnFocus.RightWorld != null)
            {
                CowGameScreen.ChangeWorld(this, Direction.Right);
            }

            if (GetPosition().X + GetPosition().Width < 0 && CowGameScreen.WorldOnFocus.LeftWorld != null)
            {
                CowGameScreen.ChangeWorld(this, Direction.Left);
            }
        }