the game i am trying to create would be a kind of simulator where the color would represent a plague (or a vaccination campaing).
i would like to fill up the blue country with red (the color would spread at a knew speed) and after a few seconds the green color would start spreading at many place in the same time (also with a knew speed)
I would like to know 4 things :
how should i make thje color spread?
how could i make color spread on the image of the world map without coloring the sea?
how could I create bridge between the country?
how could i create a function that would be trigged later and would also spread color (like the first one
but it would even color the first one)
and heres the map were i am trying to make de color spread :
spreading colors!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
spreading colors!
- Attachments
-
- lua - Copie (2).rar
- (351.01 KiB) Downloaded 95 times
Re: spreading colors!
love.graphics.setColor() or having two pictures?
Re: spreading colors!
im trying to make the colors spread on the map without spreading on the scea is this function able to do that??
Re: spreading colors!
and their is on picture but two colors
red would start spreading with a mouse click
and greend would spread after a set duration
red would start spreading with a mouse click
and greend would spread after a set duration
Re: spreading colors!
could you help me to implent this algorithm on my map??
i never used something like that before.
i never used something like that before.
Re: spreading colors!
i have been able to set function to generate the color but now i need to find a way to make it spread on the contry (also the color doesn't want to appear on the picture)
anyone can help me with those 2 things?
anyone can help me with those 2 things?
- Attachments
-
- lua - Copie (2) - Copie.rar
- (351.54 KiB) Downloaded 91 times
Re: spreading colors!
well now i only need 2 function:
how to make in the spread
and how to make it spread only on the blue contry
heres my work by now:
how to make in the spread
and how to make it spread only on the blue contry
heres my work by now:
- Attachments
-
- lua - Copie (2) - Copie.rar
- (351.54 KiB) Downloaded 100 times
Re: spreading colors!
You can write a sort of data map that corresponds to the image map, a grid of places on your map, and then apply the algorithm to that based on the map color info.
Alternatively, you could draw the picture onto a canvas and then use https://www.love2d.org/wiki/Canvas:getPixel to make the previously mentioned grid of your map, or any map in the future.
Alter-alternatively , you could use the getPixel function with a list of "active pixels" that spread with rules similar to the game of life, except not as limited when it comes to being cramped. And just make the clicked pixel spread in a + shape around it, then remove it from active list and add the 4 new pixels to active list and make them check for blue pixels around them.
Alternatively, you could draw the picture onto a canvas and then use https://www.love2d.org/wiki/Canvas:getPixel to make the previously mentioned grid of your map, or any map in the future.
Alter-alternatively , you could use the getPixel function with a list of "active pixels" that spread with rules similar to the game of life, except not as limited when it comes to being cramped. And just make the clicked pixel spread in a + shape around it, then remove it from active list and add the 4 new pixels to active list and make them check for blue pixels around them.
- slime
- Solid Snayke
- Posts: 3177
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: spreading colors!
FYi - Canvas:getPixel is very, very slow. Nearly as slow as [wiki]Canvas:getImageData[/wiki] most of the time. So just use the latter function if you want to get more than one pixel from a Canvas, unless memory is the primary concern and performance is no concern. 

Who is online
Users browsing this forum: No registered users and 6 guests