To answer you earlier question, yes
It may be easier to ensure different colours for each polygon, then you can use the pixel colour selected to execute a command
To answer you earlier question, yes
It may be easier to ensure different colours for each polygon, then you can use the pixel colour selected to execute a command
That was the idea, but the real problem is onclick event. As the provinces' color can change, i can't use the color option. I have to check the clicked point is in which polygon i guess.
Sprites will be like the map i sent before.
Are you building a game? Here is a similar game that uses several map regions displayed on a Canvas.
Mountain Kingdom - a chat real time two player, two device game using the CloudDB and a Canvas .
This is not a Risk clone but uses concepts that are similar .
I saw you game, it is amazing. But as i understand colors of provinces of your map doesn't change.
Thank you.
Correct, you can only change them if you provide different maps with different colors. The map is a BackgroundImage.
Here is a way to draw a shape on a Canvas and save a different color to the shape. Awkward but it works.
So, the countries are all Sprites and I presume you want to click a sprite to reveal more about the country?
You can add the numbering to the Sprite images. The text identifying the continents could also be image Sprites. The lines can be drawn on the Canvas.
if the text is not too much, you can make the letters in to sprites, one letter one sprite. and add sprite on top of your map sprite by dynamic component extension.
Another question - what device type is your App going to run on?
So, not really sure what you need but here is an example of how you might get to what you need.
SpriteMap.aia (19.4 KB)
Thanks for your help, but the problem is nothing but onclick event. How can i know which province is clicked.
As Steve mentioned, I'm trying to make risk-like game. And Android.
That's great idea. As i'm using only numbers, i will only need 10 different images.
With a little bit of ingenuity you could do this by polling the province color.
Really
What you do depends on how you build or display your province polygons. If you use sprites, you may have an overlap issue as the sprite is always a rectangle, even if it has transparent parts.
Good luck. Seems a fun Project.
That is what Tim said. But as the province colors will change, I can't use this option. I tried to make it with 2 canvases. Default colors will be in first canvas, and coords I clicked in second canvas will request pixelcolor to first canvas. I set first canvas invisible but it always shows rgba(255,255,255,0)
Are you unable to keep track of the province colour changes ? You have 16.7 million colours to play with....
Captured provinces change their color to the captured one. So if I click on red, how can i know which province it is?
Which one is Red ?
255,0,0 / 255,0,1 / 255,0,2
Understood, I will try, thanks.
Here an extension to change color.