For puzzle game.
How i can slice rectangle or any shape to slice like that (randomly):
Hello. In addition to yours, how can I divide any picture into parts like the one in the picture and add a separate touch function to each part?
I do it with BitmapData.js. But I want to determine how many yellow and green colors were painted.
That possible with bitmap and fill with floodFill we do that in that game:
משחק צביעה פסח - משחק השבת - משחק לפרשת השבוע
First of all, thank you for your answer.
I can do something similar to what you do with BitmapData.js.
What I want is to paint some parts yellow and some parts red. The areas I want should be painted red. For example, let him color the capital letter "A" yellow. Let him color the lowercase letter "a" blue. If he paints and finishes all of them according to the instructions I have previously determined, the task will be completed.
Also, how do you prevent the black lines of the picture in the link you sent from being painted over?
I wrote the following code for BitmapData.js:
var targetColor = this.getPixel32(x, y);
//4278190080 //// this is black color....
if (targetColor === color||targetColor===4278190080) {
return;
}
This code prevents black lines from being painted.
Do you think this code makes sense? Or should I do something else?
We made it with to layers one only shows the black and the under is for the colors.
Yours check is ok, to sure that i have only 2 colors i make it from gif file. i think that possible with code but dont found yet a good way to do that.
to found the area the color i think you can get the coloring area and getPixel to know if its in the right color.
I do not know. There may be a way to do it with an algorithm or equations.
If you have points of all the shapes then you can make Blob objects and use those to mask copies of the picture - if there is a picture.
The way I would do it would be to make a template then record which blobs share the same points. Then randomly move the points a little and rotate and flip the pattern randomly. So fake it. If you really need to, make two or three templates and randomly use them. I guess I would search for an equation way first.