scp94373
7 months ago  Karma: 152
CryptoZombies/CryptoKitties code

Dear all,

I have a query about combining different colours with different parts of the image such as Zombies or Kitties, I don't understand how I can choose a colour for the part of the picture short of making every possible outcome and assigning it a number then using the modulus formula to get a random number based on the TXHash or something. Or is that how Crypto Kitties/ Crypto Zombies did it?

If this doesn't make sense, lets say I have a bird, and I want the wings to be a changeable colour depending on what the random number is for a person, so if someone gets 59, then it will be blue wings, if someone gets 31 then it will be yellow. Is there a way to assign the colours on the wings without having to make every variation?

Thanks,

Sam

en
#cryptokitties
#cryptozombies
scp94373
7 months ago  Karma: 152
CryptoZombies/CryptoKitties code

Dear all,

I have a query about combining different colours with different parts of the image such as Zombies or Kitties, I don't understand how I can choose a colour for the part of the picture short of making every possible outcome and assigning it a number then using the modulus formula to get a random number based on the TXHash or something. Or is that how Crypto Kitties/ Crypto Zombies did it?

If this doesn't make sense, lets say I have a bird, and I want the wings to be a changeable colour depending on what the random number is for a person, so if someone gets 59, then it will be blue wings, if someone gets 31 then it will be yellow. Is there a way to assign the colours on the wings without having to make every variation?

Thanks,

Sam

en
#cryptokitties
#cryptozombies

3 ANSWERS
kaijchang2
7 months ago Karma: 19856

You could use hex color codes, which is a system that names colors by their hex values, which can be converted into a number. For example 000000 in hex or 0 in base 10 is black, and ffffff in hex or 16777215 in base 10 is white. Blue is 0x0000FF (255), and yellow 0xFFFF00 (16776960).

I'm not sure what Cryptozombies and Cryptokitties use, I'm sure their formula is more complex because they need more than one color or feature, but this is definitely a way you could do it.

You could use hex color codes, which is a system that names colors by their hex values, which can be converted into a number. For example 000000 in hex or 0 in base 10 is black, and ffffff in hex or 16777215 in base 10 is white. Blue is 0x0000FF (255), and yellow 0xFFFF00 (16776960).

I'm not sure what Cryptozombies and Cryptokitties use, I'm sure their formula is more complex because they need more than one color or feature, but this is definitely a way you could do it.

clam0

I think he was asking how to narrow down the set of choices. It seems simple but maybe he didnt realize that simply mapping a number range to a certain color. like if (x >= 1 && x <= 100)

Aug 05 '18 at 5:39 pm
scp94373
7 months ago Karma: 152

Thanks both for your answers they both help! I was curious whether in your opinion if they split the image up into different parts to use masking in CSS for the colours of different parts (then how do they put the image back together) or are they able to assign a part of an image to an ID and then link that ID to what colour you want to mask it with? :) I'm sure it's a simple solution and I'm just being silly :P

Thanks both for your answers they both help! I was curious whether in your opinion if they split the image up into different parts to use masking in CSS for the colours of different parts (then how do they put the image back together) or are they able to assign a part of an image to an ID and then link that ID to what colour you want to mask it with? :) I'm sure it's a simple solution and I'm just being silly :P

scp94373
7 months ago Karma: 152

So it looks like they use CSS Clip path to assign colours to shapes as they use vector graphics (*.svg) which I'm now looking into, but want an easier way of this, such as doing it via the gui and then copying the code.

So it looks like they use CSS Clip path to assign colours to shapes as they use vector graphics (*.svg) which I'm now looking into, but want an easier way of this, such as doing it via the gui and then copying the code.

Earn tokens by posting and answering questions about blockchain!
Karma to eth
YOUR ANSWER