Archived

This topic is now archived and is closed to further replies.

jridenour

[java] board game question in swing

Recommended Posts

Hello, Im working on converting a multiplayer strategy game into java/swing. i have a large gif file containing about 100 individual spaces, that i want linked to individual "objects", and that i want selectable when you click on one. My idea to do this is to cut up the gif into a 100 little ones for each space, making a jbutton object with transparent parts for each space, and then using pixel grabber each time a jbutton was clicked to see if the space was clicked. is there a better way to do this? any other ideas? thanks, jeff

Share this post


Link to post
Share on other sites
Well that would work, but the pixelGrabber is v.slow and swing has its own issues! If it were me, i'd use an ImageIcon and store the coordinate and collision detection in the image/sprite object.

Edited by - bobbin on April 26, 2001 6:45:26 AM

Share this post


Link to post
Share on other sites
ok, but how do you store that? They aren''t simple rectangles, so i guess I would need to use a mask of some sort, but wouldn''t that be a graphic file also? Or is there some special object that would hold a collision detection mask that i can create from a graphic?

thanks,

jeff

Share this post


Link to post
Share on other sites