[java] board game question in swing

Started by
1 comment, last by jridenour 22 years, 11 months ago
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
Advertisement
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
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

This topic is closed to new replies.

Advertisement