/// <summary> /// Constructors a new sprite. /// </summary> public Player(string p_XMLFile, Vector2 initialPosition) { sprite = new Sprite(GV.ContentManager, p_XMLFile); this.state = new IdleState(this); this.Direction = GV.RIGHT; Sprite.Scale = 1.0f; velocity = new Vector2(0,0); Position = initialPosition; localBounds = new Rectangle(Sprite.BoundingBox.Left, Sprite.BoundingBox.Top, Sprite.BoundingBox.Width, Sprite.BoundingBox.Height); }
// Constructor public HittingState(PlayerState state) : this(state.Player) { }
// Constructor public MagicAttackState(PlayerState state) : this(state.Player) { }
/// <summary> /// Constructor /// </summary> /// <param name="state"></param> public IdleState(PlayerState state) : this(state.Player) { }
/// <summary> /// Constructor /// </summary> /// <param name="state"></param> public WalkingState(PlayerState state) { this.player = state.Player; Player.Sprite.PlayAnimation("walking"); Player.MaxLightRadius = 150; }
// Constructor public LightState(PlayerState state) : this(state.Player) { }
/// <summary> /// Constructors /// </summary> /// <param name="state"></param> public JumpingState(PlayerState state) : this(state.Player) { }
/// <summary> /// resets the players health and coordinates from the checkpoint. /// </summary> public void ResetPlayer() { this.state = new IdleState(this); this.Direction = GV.RIGHT; Sprite.Scale = 1.0f; velocity = new Vector2(0, 0); Position = CheckPoint; IsAlive = true; health = 600; }