collision in android

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • game2d
    New Member
    • Apr 2013
    • 59

    collision in android

    if i want collision between two objects. lets say object 1 is ball and object 2 is box. than in java i can use the getBounds().int ersects methods to test if they both are colliding.

    so my question is that is there a function in android that i can use?

    here is what i found out on google but nore 100% sure.

    so insert of using
    Code:
    public Rectangle getBounds()
      { return ... }
    i can use
    Code:
    public Rect getBounds()
      { return ... }
    to test if collisionr.

    Code:
     if (ball.getBounds().intersect(box.getBounds())) {
    }
    wasnt working for some reason. i also tried "intersects " but doesnt work
  • shoppingin
    New Member
    • Aug 2013
    • 10

    #2
    Please use intersect api.

    Comment

    Working...