Advertisement
dajver

Tet collision

Mar 29th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.26 KB | None | 0 0
  1. Iterator<Enemy> i = rx.iterator();
  2. while (i.hasNext()) {
  3.     Enemy sp = i.next();
  4.     if ((Math.abs(sp.x - p.x) <= ((sp.width + p.width) / 2f))
  5.             && (Math.abs(sp.y - p.y) <= ((sp.height + p.height) / 2f))) {
  6.         i.remove();
  7.     }
  8. }
  9.        
  10. // p - player
  11. // sp - enemy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement