ulfben icon

Collision pairs

ulfben | PRO | 02/27/17 06:22:45 PM UTC | 0 ⭐ | 856 👁️ | Never ⏰ | []
Java |

790 B

|

None

|

0 👍

/

0 👎

import java.util.ArrayList;
public class Collision {
    private static ArrayList<Collision> POOL = new ArrayList<Collision>();
    public GameObject mA;
    public GameObject mB;        
    
    public static Collision init(GameObject a, GameObject b) {
        if (POOL.isEmpty()) {
            return new Collision(a, b); //added to the pool on release
        }
        Collision c = POOL.remove(0);
        c.mA = a;
        c.mB = b;
        return c;
    }
 
    public static void release(Collision c) {
        c.mA = null;
        c.mB = null;
        POOL.add(c);
    }
    
    public boolean equals(Collision c) {
        return (mA == c.mA && mB == c.mB) || (mA == c.mB && mB == c.mA);
    }
    
    public Collision(GameObject a, GameObject b) {
        mA = a;
        mB = b;
    }
}

Comments

  • Gyqizv icon
    04/02/26 05:59:13 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎