Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Comparing Colors: Risk Clone

Author
Message
wyatt822
16
Years of Service
User Offline
Joined: 16th Mar 2009
Location:
Posted: 16th Mar 2009 15:35
Hi, I've been trying to find some help with comparing color values. I'm attempting to make a Risk clone, and have come across an issue with the FloodFill function allowing me to change the color of the ocean as well as the territories.

What I would like to try is looking at the rgb of the ocean areas. If the mouse is clicked on an area with that specific rgb value, the floodfill function should do nothing. Otherwise, it should color the area (as it does currently). Any suggestions would be much appreciated. Thanks in advance.

Attachments

Login to view attachments
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 16th Mar 2009 20:25
umm if currentcolor!newcolor then color land lol

New Site! Check it out \/
wyatt822
16
Years of Service
User Offline
Joined: 16th Mar 2009
Location:
Posted: 16th Mar 2009 21:16
@caleb
Makes complete sense to do it that way. I'll try it out. Thanks for the suggestion.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 17th Mar 2009 00:30
@wyatt822
There was a problem with your coding. In your Main Loop you CLS but did not re-paste the images. If you're going to Floodfill a still image then it might be a good idea to not CLS at all.

Somethings you can do:
1. Save the original Background image (with both territories) as Image 1.
2. When you need to floodfill a territory, load up the original Image 1 and floodfill it then save into Image 2.
3. Use Image 2 as background. When you floodfill again repeat step 2.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 17th Mar 2009 02:16
anytime. lol

New Site! Check it out \/
wyatt822
16
Years of Service
User Offline
Joined: 16th Mar 2009
Location:
Posted: 17th Mar 2009 14:00
Thanks for all of the suggestions.

@ashingda: I attempted something similar to what you suggested, which was kind of like something a friend had mentioned. It's still not perfect, but much better than before.

I have 2 identical images...but one with all territories colored gray (with different rgb values). This is the one that I use to color, then copy it over to and redisplay the game screen.


[img]null[/img]

Attachments

Login to view attachments
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Mar 2009 08:08
How many different colours are there?
you could just make several images of different colour for each country, that's what all the versions I've seen do.
Not as fun but a lot quicker.
Unless you're planning on having movable borders which would be cool and really complicated

The Universe has been erased by a mod because it was larger
than 240x80 pixels.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 19th Mar 2009 20:17
@wyatt822
Your codes are still in DBP version, it won't run in DBC as it is.

Back on topic, there are better options than using a floodfill to get the same effect.

I think it's a good idea if you learn how to do Buttons with colorkey first.

I'll give you an example of how it works:

Use the mouse and click on the boxes.
wyatt822
16
Years of Service
User Offline
Joined: 16th Mar 2009
Location:
Posted: 26th Mar 2009 14:29
Sorry I haven't been responding...I've been sick and haven't had time to get in and read the suggestions/write back. I'll get to trying out the above suggestions in the next week or so and will be sure to respond. Thanks everyone.

Login to post a reply

Server time is: 2025-05-17 09:54:44
Your offset time is: 2025-05-17 09:54:44