public virtual void PrepareMove(GameTime gameTime) { if (MoveableBodyState != MoveableBodyStates.Dead && MoveableBodyState != MoveableBodyStates.Attacking) { if (InputManager.ActionIsPressed("MoveRight")) { MoveRight(); } else if (InputManager.ActionIsPressed("MoveLeft")) { MoveLeft(); } if (InputManager.ActionIsPressed("MoveUp")) { if (CanJump()) { Jump(); } } if (InputManager.ActionWasJustPressed("Attack")) { Attack(); } } }
private void FreeRoamCamera() { if (inputManager.ActionIsPressed("MoveLeft")) { Position += new Vector2(-freeroamVelocity.X, 0); } if (inputManager.ActionIsPressed("MoveRight")) { Position += new Vector2(freeroamVelocity.X, 0); } if (inputManager.ActionIsPressed("MoveUp")) { Position += new Vector2(0, -freeroamVelocity.Y); } if (inputManager.ActionIsPressed("MoveDown")) { Position += new Vector2(0, freeroamVelocity.Y); } //After updating position we can calculate view matrix CalculateViewMatrix(); }
private void Move() { if (inputManager.ActionIsPressed("MoveDown")) { if (direction != Direction.Down) { _texture = _texture_normal; } direction = Direction.Down; } if (inputManager.ActionIsPressed("MoveUp")) { if (direction != Direction.Up) { _texture = _texture_flip; } direction = Direction.Up; } if (inputManager.ActionIsPressed("MoveLeft")) { Velocity.X = -Speed; } if (inputManager.ActionIsPressed("MoveRight")) { Velocity.X = Speed; } if (direction == Direction.Up) { Velocity.Y = -Speed; } if (direction == Direction.Down) { Velocity.Y = Speed; } }