public override void CollideWithUnit(Player Unit) { Point unitCollisionPoint = new Point(Unit.HitBox().Left + Unit.HitBox().Width/2, Unit.HitBox().Top + Unit.HitBox().Height/2); if(HitBox().Contains(unitCollisionPoint) && KeyMouseReader.KeyClick(Keys.Space)) Unit.ResetPosition(); }
public void Update(Player player, float elapsedTime) { timeLived += elapsedTime; position.X += direction.X * speed; position.Y += direction.Y * speed; if (timeLived >= lifeTime) active = false; if (HitBox().Intersects(player.HitBox())) if (AccuratePlayerHitCheck(player.HitBox())) active = false; }
public static void Update(Player player, float elapsedTime) { for (int i = 0; i < enemyList.Count; i++) { enemyList[i].Update(elapsedTime, player); if (enemyList[i].HitBox().Intersects(player.HitBox())) enemyList[i].CollideWithPlayer(player); enemyList[i].SpecialAbility(player); } }
public override void CollideWithUnit(Player Unit) { Point unitCollisionPointLeft = new Point(Unit.HitBox().Left + 15, Unit.HitBox().Top + Unit.HitBox().Height - 2); Point unitCollisionPointRight = new Point(Unit.HitBox().Right - 15, Unit.HitBox().Top + Unit.HitBox().Height - 2); if(HitBox().Contains(unitCollisionPointLeft) && HitBox().Contains(unitCollisionPointRight)) Unit.Jump(1.5f); base.CollideWithUnit(Unit); }
public virtual void CollideWithPlayer(Player player) { if (PixelCol(HitBox(), colorArray, player.HitBox(), player.ColorArray)) player.gotKilled = true; }