Esempio n. 1
0
 public void Update(GameTime gametime)
 {
     /*
      * if (player.Velocity == Vector2.Zero && animator.CurrentAnimation.Name != "idle")
      * {
      *  animator.ChangeAnimation("idle");
      * }
      */
     animator.Update(gametime);
 }
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)
        {
            // Allows the game to exit
            if ((GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) || Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            // TODO: Add your update logic here
            m_character.Location = new Vector2(320, 380);
            m_character.Scale    = 0.75f;
            m_character.Rotation = 0.0f;
            m_character.FlipX    = false;
            m_character.FlipY    = false;

            m_character.Update(gameTime);

            base.Update(gameTime);
        }
Esempio n. 3
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            animator.Location = Position + new Vector2(0, 256 * animator.Scale / 2);
            animator.Update(gameTime);

            // Haetaan lähin monsteri.
            Monster nearest = Game.Instance.GameObjects.FindNearest <Monster>(Position) as Monster;

            if (nearest != null)
            {
                targetingComponent.ChangeTarget(nearest);
            }

            // Jos monsteri on jo kuollut ja se on vieläkin targettina, clearitaan target.
            if (!Game.Instance.ContainsGameObject(nearest))
            {
                nearest = null;
                targetingComponent.ClearTarget();
            }

            animator.FlipX = Velocity.X < 0;
        }