You can define bounding rectangles for your sprites using Rect or
RectF. And then use methods like

boolean  contains(int x, int y) //Returns true if (x,y) is inside the
rectangle.
boolean  contains(Rect r) //Returns true if the specified rectangle r
is inside or equal to this rectangle.
static boolean  intersects(Rect a, Rect b) //Returns true if the two
specified rectangles intersect.
boolean  intersects(int left, int top, int right, int bottom)//
Returns true if this rectangle intersects the specified rectangle.


On Jun 2, 3:51 pm, lixinso <[email protected]> wrote:
> I wanna to create an game like plane shooting game.
> There are many sprite like bullet or plane, they moves every frame.
> There is a need to do collision detection. In JavaME , it's quite
> easy, just use a Sprite, and the function of .CollideWith().
> Everything is OK.
>
> But in Android, there is no  javax.microedition.lcdui.game package.
>
> So, how to do the collision detection in Android SDK?
>
> Is there any sample example that can share?
>
> Thanks everyone very much.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to