How to Compare the position of two images

Hi,I want to Compare the position of two images and give out a beep (or anything) when one image 'hits' tghe other. How do I achieve this effect?Thankx in advance...
[195 byte] By [alikamran] at [2007-9-26 2:22:41]
# 1

> Hi,

> I want to Compare the position of two images and give

> out a beep (or anything) when one image 'hits' tghe

> other. How do I achieve this effect?

> Thankx in advance...

I guess what you are doing is like a pong or something?

In your code you need to have some sort of check every cycle of movement and see if the objects overlap. If you are using Polygon this is if (a.intersects(b))

If the object is not a polygon or not a rectagle you can create your own shape class either extending Polygon of implementing Shape.

dubwai at 2007-6-29 9:29:36 > top of Java-index,Core,Core APIs...