Shapes from buffered images/collision detection
Hi,
Two things really:
1) How can I get a shape from an image? For instance, say I had a image of a ball on a transparent background and I wanted to get the eclipse shape of the ball?
2) All the classes I抦 making, are going into my game API, how can I do collision detection using the bounding shape crated? (referring to the above question) At the moment, all my game components extend JComponent and I am using the getBounds().intersects() to test for a collision, I don抰 think this would be much different to the getShape().
Any help on this would be grand.
Luke
[602 byte] By [
dfgstga] at [2007-11-26 17:47:10]

# 1
> 1) How can I get a shape from
> an image? For instance, say I
> had a image of a ball on a transparent
> background and I wanted to get the
> eclipse shape of the ball?
You could make a Ball class that keeps track of all that information.
> 2) All the classes I抦 making, are
> going into my game API, how can
> I do collision detection using the
> bounding shape crated?
You're going to have to implement it yourself.
# 2
> You could make a Ball class that keeps track of all
> that information.
The ball was just an example, but you can see the idea, instead of a great big rectangle, it would be nice to cut out a shape from the image
> > 2) All the classes I抦 making, are
> > going into my game API, how can
> > I do collision detection using the
> > bounding shape crated?
>
> You're going to have to implement it yourself.
Yer, I don't really know why I said that, sorry :)