Exemplo n.º 1
0
 public Boolean CollisionMainAndEnemy(MainChar M, Enemy E)
 {
     Vector2 MPos = M.getPosition();
     Vector2 EPos = E.getPosition();
     if (MPos.X + (M.getTex().Width) > EPos.X && MPos.Y + (M.getTex().Height) > EPos.Y && MPos.X + (M.getTex().Width) < EPos.X + E.getTex().Width && MPos.Y + (M.getTex().Height) < EPos.Y + E.getTex().Height
         || MPos.X + (M.getTex().Width) > EPos.X && MPos.Y > EPos.Y && MPos.X + (M.getTex().Width) < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y + (M.getTex().Height) > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y + (M.getTex().Height) < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height)
     {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
 public Boolean CollisionBoltAndEnemy(Bolt B, Enemy E)
 {
     Vector2 MPos = B.getPosition();
     Vector2 EPos = E.getPosition();
     if (MPos.X + (B.getBolt1().Width) > EPos.X && MPos.Y + (B.getBolt1().Height) > EPos.Y && MPos.X + (B.getBolt1().Width) < EPos.X + E.getTex().Width && MPos.Y + (B.getBolt1().Height) < EPos.Y + E.getTex().Height
         || MPos.X + (B.getBolt1().Width) > EPos.X && MPos.Y > EPos.Y && MPos.X + (B.getBolt1().Width) < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y + (B.getBolt1().Height) > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y + (B.getBolt1().Height) < EPos.Y + E.getTex().Height
         || MPos.X > EPos.X && MPos.Y > EPos.Y && MPos.X < EPos.X + E.getTex().Width && MPos.Y < EPos.Y + E.getTex().Height)
     {
         return true;
     }
     return false;
 }