public Slash(float x, float y, float dirX, float dirY, Damage.Side side) : base(x, y) { sprite = new Spritemap(Global.imagePath + "Player/Slash.png", 64, 64); sprite.Add(0, new Anim("0-3", "3")); sprite.Angle = MathHelper.ToDegrees((float)Math.Atan2(dirX, dirY)) + 90; sprite.FlippedY = dirX > 0; sprite.SetOrigin(0, 32); AddGraphic(sprite); sprite.Play(0); sprite.Anims[0].NoRepeat(); sprite.Anims[0].OnComplete += () => { RemoveSelf(); }; AddComponents(damage = new Damage(5, x, y, side)); var col = new LineCollider(-dirX * 10, -dirY * 10, -dirX * 50, -dirY * 50, Global.Tags.Attack); AddCollider(col); AddComponent(new YSort()); }
public Projectile(float x, float y, float dirX, float dirY, Damage.Side side) : base(x, y) { this.dirX = dirX; this.dirY = dirY; this.side = side; sprite = new Spritemap(Global.imagePath + "FX/projectile.png", 32, 32); sprite.Add(0, new Anim("0-5", "2")); sprite.Play(0); sprite.CenterOrigin(); AddGraphic(sprite); AddCollider(new CircleCollider(4, Global.Tags.Attack)); Collider.CenterOrigin(); damage = AddComponent(new Damage(5, X, Y, side)); AddComponent(new YSort()); LifeSpan = 250; }