Ejemplo n.º 1
0
 public override void Update(float ms)
 {
     ms /= 1000f;
     _movement.Y += Player.gravity * ms;
     Move(new Vector2(0, Movement.Y*ms));
     if (map.Collides(this))
     {
         Move(new Vector2(0, -Movement.Y*ms));
         _movement.Y *= -0.4f;
         _movement.X *= 0.4f;
     }
     Move(new Vector2(Movement.X*ms, 0));
     if (map.Collides(this))
     {
         Move(new Vector2(-Movement.X*ms, 0));
         _movement.X *= -0.4f;
         _movement.Y *= 0.4f;
     }
     lifeTime -= ms*1000;
     if (lifeTime <= 0)
     {
         Attack att = new Attack(_map, 64, new Rectangle((int)this.MidPosition.X - 20, (int)this.MidPosition.Y - 20, 40, 40), Vector2.Zero, 100, parentID, groupID, 4, map.ObjectManager.getID());
         att.Penetrates = true;
         att.HitOnce = false;
         _manager.Spawn(att);
     }
 }
Ejemplo n.º 2
0
 public override void Hit()
 {
     Attack att = new Attack(_map, 4, new Rectangle((int)this.MidPosition.X - 20, (int)this.MidPosition.Y - 20, 40, 40), Vector2.Zero, 50, parentID, groupID, 6, map.ObjectManager.getID());
     att.Penetrates = true;
     att.HitOnce = false;
     _manager.Spawn(att);
     DoEffect(3, _rect.Center, _movement, "");
 }
Ejemplo n.º 3
0
 public override Attack GetAttack(Player owner,Vector2 dir, int DmgBonus, int info)
 {
     Attack att = null;
     att = new Attack(owner.map, 17, new Rectangle((int)owner.MidPosition.X, (int)owner.Position.Y + owner.Rect.Height - 16, 10, 16), new Vector2(200, 0), 500, owner.ID, owner.GroupID, 5004, owner.map.ObjectManager.getID());
     att.HitOnce = true;
     att.Knockback = new Vector2(200, -50);
     return att;
 }
Ejemplo n.º 4
0
 public override Attack GetAttack(Player owner,Vector2 dir, int DmgBonus, int info)
 {
     Attack att = null;
     Rectangle startRect = owner.Rect;
     startRect.Height -= 4;
     startRect.Y += 3;
     startRect.X += (int)(dir.X*8);
     att = new Attack(owner.map, 15, startRect, new Vector2(owner.LastSpeed.X, 0) + 200 * dir, 100, owner.ID, owner.GroupID, 1, owner.map.ObjectManager.getID());
     att.HitOnce = true;
     owner.Attack(0.3f);
     return att;
 }
Ejemplo n.º 5
0
 public void Spawn(Attack attack)
 {
     _server.SetChannel(3);
     SpawnAttackMessage sam = (SpawnAttackMessage)_server.ProtocolHelper.NewMessage(MessageTypes.SpawnAttack);
     sam.id = attack.ID;
     sam.attackID = attack.AttackID;
     sam.position = attack.Rect;
     sam.move = attack.Movement;
     sam.Encode();
     _server.SendAllMapReliable(attack.map, sam, true);
     attack.SetAttackManager(this);
     _addAttack.Add(attack);
 }
Ejemplo n.º 6
0
 public void Spawn(IMap map, int damage, Rectangle rect, Vector2 mov, float lifeTime,int parentID, int id)
 {
     Attack attack = new Attack(map, damage, rect, mov, lifeTime, parentID, 0, id,map.ObjectManager.getID());
     Spawn(attack);
 }
Ejemplo n.º 7
0
 public override Attack GetAttack(Player owner,Vector2 dir, int DmgBonus, int info)
 {
     Attack att = null;
     if (owner.LookLeft)
     {
         att = new Attack(owner.map, 4, new Rectangle((int)owner.MidPosition.X, (int)owner.Position.Y + owner.Rect.Height - 16, 5, 8), new Vector2(-200, 0), 2200, owner.ID, owner.GroupID, 5005, owner.map.ObjectManager.getID());
     }
     else
     {
         att = new Attack(owner.map, 4, new Rectangle((int)owner.MidPosition.X, (int)owner.Position.Y + owner.Rect.Height - 16, 5, 8), new Vector2(200, 0), 2200, owner.ID, owner.GroupID, 5005, owner.map.ObjectManager.getID());
     }
     att.HitOnce = true;
     return att;
 }