private void AttackTop() { this.spriteTexture = attackUpTexture; Point topLeftPoint = new Point(this.locationRect.Left, this.locationRect.Top - spriteTexture.Height); Point bottomRightPoint = new Point(this.locationRect.Right, this.locationRect.Top); Rectangle attackZoneTop = new Rectangle(topLeftPoint, bottomRightPoint); this.attackDir = PlayerAttackDir.Up; }
private void AttackDown() { this.spriteTexture = attackDownTexture; Point topLeftPoint = new Point(this.locationRect.Left, this.locationRect.Bottom); Point bottomRightPoint = new Point(this.locationRect.Right, this.locationRect.Bottom + this.spriteTexture.Height); Rectangle attackZoneBottom = new Rectangle(topLeftPoint, bottomRightPoint); this.attackDir = PlayerAttackDir.Down; }
private void AttackRight() { this.spriteTexture = attackRightTexture; Point topLeftPoint = new Point(this.locationRect.Right, this.locationRect.Top); Point bottomRightPoint = new Point(this.locationRect.Right + this.spriteTexture.Width, this.locationRect.Bottom); Rectangle attackZoneRight = new Rectangle(topLeftPoint, bottomRightPoint); this.attackDir = PlayerAttackDir.Right; }
private void ResetIdleSprite(float timeInMs) { if (this.spriteTexture != idleTexture && controller.HandleKeyboard() == "No Input") { this.attackDir = PlayerAttackDir.Idle; currentTime += timeInMs / 1000; if (currentTime >= timeBeforeIdleReset) { this.spriteTexture = idleTexture; currentTime = 0f; } } else if (controller.HandleKeyboard() != "No Input") { currentTime = 0f; IsHurt = false; } }
public override void Initialize() { this.attackDir = PlayerAttackDir.Idle; base.Initialize(); }