SigmaTech
|
  |
| Joined: 28 Jan 2010 |
| Total Posts: 643 |
|
|
| 21 Jun 2014 04:23 PM |
http://www.roblox.com/SigmaTechs-Hackathon-Entry-place?id=162505999
->Bricks around a sphere get their colors inverted (I did this by subtracting the existing color3 value of each color multiplied by 255. [ex. r*255], then I divided the whole thing by 255.
..And if there's an even amount of spheres, it cancels out
->Bricks around a cylinder don't change.
..And if there's an even amount of cylinders, it cancels out |
|
|
| Report Abuse |
|
|
SigmaTech
|
  |
| Joined: 28 Jan 2010 |
| Total Posts: 643 |
|
|
| 21 Jun 2014 04:24 PM |
Correction for the color inversion thing
I did this by subtracting the existing color3 value of each color multiplied by 255 [ex. r*255] from 255, then I divided the whole thing by 255.
|
|
|
| Report Abuse |
|
|
SigmaTech
|
  |
| Joined: 28 Jan 2010 |
| Total Posts: 643 |
|
|
| 21 Jun 2014 04:38 PM |
So formula for color inversion:
Let's focus on one color. We'll stick with red.
You HAVE to make your color values divided by 255 all the time for them to work. Otherwise you'll have to type one's and zero's. (Black and white)
existingColor = Color3.new(4/255,234/255,123/255)
1) You take the existing value
existingColor.r
2) Multiply it by 255 to get an out-of 255 number
existingColor.r*255
3) Subtract the value from 255.
255 - existingColor.r*255
4)Divide the whole thing by 255 to put it in.
(255-existingColor.r*255)/255
F) This is an example result of one color in Color3. |
|
|
| Report Abuse |
|
|
flump
|
  |
| Joined: 30 Jul 2008 |
| Total Posts: 1039 |
|
|
| 21 Jun 2014 05:01 PM |
Color.r is given as a percentage of 0 - 255 (0 = 0) (1 = 255) (.5 = 127.5)
so instead of * the Color.r by 255 and then taking the result away from 255 why not skip a step and just take Color.r away from 1
lets say Color.r = .75
so Color.r * 255 = 191.25 255 - 191.25 = 63.75 63.75/255 0 .25 which is correct
but you could do 1 - Color.r = .25 1 - .75 = .25
Hope this helps making your code more efficent
|
|
|
| Report Abuse |
|
|
| |
|
SigmaTech
|
  |
| Joined: 28 Jan 2010 |
| Total Posts: 643 |
|
|
| 21 Jun 2014 06:36 PM |
@Flump
Yeah. I saw someone else say this and I said "Derp."
255/255 = 1
154/255 = 0.something
Yeh.
I was in a rush in hackathon. The scripts have the lowest efficiency ever. There was no need to make it efficient, because seriously, I'm not going to get like 100 visitors. |
|
|
| Report Abuse |
|
|
| |
|