Exemplo n.º 1
0
 public override void Kill()
 {
     base.Kill();
     death.flippedHorizontally = moveAnimation.flippedHorizontally;
     death.Start();
     jumpSpeed = 0;
     fallSpeed = 0;
     velocity  = new Vector2(0, 0);
     position  = new Vector2((float)(position.X - 20.0), (float)(position.Y - 35.0));
 }
Exemplo n.º 2
0
        public override void Update(GameTime gameTime, InputManager input)
        {
            base.Update(gameTime, input);
            if (!throwing)
            {
                if (input.KeyDown(Keys.Right, Keys.D))
                {
                    velocity.X                         = horizontalSpeed;
                    walkAnimation.isPaused             = false;
                    walkAnimation.flippedHorizontally  = false;
                    throwAnimation.flippedHorizontally = false;
                }
                else if (input.KeyDown(Keys.Left, Keys.A))
                {
                    velocity.X                         = -horizontalSpeed;
                    walkAnimation.isPaused             = false;
                    walkAnimation.flippedHorizontally  = true;
                    throwAnimation.flippedHorizontally = true;
                }
                else
                {
                    velocity.X             = 0;
                    walkAnimation.isPaused = true;
                }
                //running
                if (input.KeyDown(Keys.LeftShift))
                {
                    velocity.X *= 1.5f;
                }

                if (input.KeyDown(Keys.Space))
                {
                    throwing = true;
                    throwAnimation.Start();
                }

                if (input.KeyDown(Keys.Up))
                {
                    this.Jump();
                }
            }
            else if (isOnGround())
            {
                velocity.X = 0;
            }
            walkAnimation.Update(gameTime);
            throwAnimation.Update(gameTime);
        }
Exemplo n.º 3
0
 public override void Throw()
 {
     throwAnimation.Start();
 }