Jump to content

GD Library? changing color of an area


Recommended Posts

OK I'm not too sure where to ask this, but bear with me.




I've made a small online multiplayer game (you can watch it at www.shugo.nl). In here I have this map of Japan, with 65 provinces. I use a red background for the .php file containing the map of Japan. For each of the 65 provinces there is a capital (shown as a large dot). In the map (which is .gif file), these dots of the .gif file containing the map are transparent, so that you see the red background color through the map. Whenever a player of the game owns a certain province, I use a php script, to show a blue square image in a -1 z-index (so that it becomes a background image, behind the map image). I use this php script also to position this blue background image below the capital, so that I get a blue dot.


The result is that any player who owns a province gets to see that by a blue dot, where as the other provinces that player doesn't own are shown with red dots. To give you an idea of the situation:



I use an sql table to store the owner of a province and such and another table to store the diplomatic stances.




What I want to do is change is this entire situation. Instead of just some dots (the province capitals) changing color, I want to change the color of the entire province, but keep the the black borders of the provinces and of course the same color for the sea and ocean.


I want to change it in such a way, that for example I get 3  different maps.


1. a map showing provinces in blue who are player controlled and red as non-player controlled

2. a map showing the various clans (there are 32 in the game, plus a number of  minor clans and possible rebels) with a diffirent color for each clan (probably not going to implement this one, because 34 different colors is hard to notice)

3. a map showing the diplomatic settings of the clan. For instance red means war and blue means peace etcetera.




Anyone know of good and (preferably easy way, though I doubt that) of doing this.


Any suggestions, hints possible solutions are very welcome.

Thanks in advance for any help.

Link to comment
Share on other sites

I tried doing this before, gave up.


How about cutting the image up into provinces? and changing the image from teh transparent dot, to a dot with the province behind it in your selected colour.


Like an image rollover.



Hope that helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.