|
| 05 Jun 2016 02:48 AM |
Sorry Im tired if that sounded funky.
So I have like a Worm object.
Like slither.io.
But I want half of it to be ... say blue. and the other half yellow.
Then there are lets say.... 8 circles that I need to color.
It would easily be 4 circles blue and 4 circles yellow. But what if its an uneven number? How would I work that out? And, what If I want to split it into 3 colors instead? Heres what I got.
local colors = {"Bright blue", "Bright yellow"} local Num = #game.Workspace.TheCoderOfLuaEel:GetChildren() local fractions = Num/#colors for i = 1, #game.Workspace.TheCoderOfLuaEel:GetChildren(), fractions do game.Workspace.TheCoderOfLuaEel:GetChildren()[i].BrickColor = BrickColor.new(colors[1]) end for i = fractions, #game.Workspace.TheCoderOfLuaEel:GetChildren(), fractions*2 do game.Workspace.TheCoderOfLuaEel:GetChildren()[i].BrickColor = BrickColor.new(colors[2]) end
Yeah so Thats rudimentary I know I could make improvements but what about rounding, how would I do that?
Thanks for help guys I know its late
|
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 05 Jun 2016 02:50 AM |
I'd totally help you but you're a brat who thumbs down my games for no reason, so have fun.
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 02:50 AM |
so 9/2 would be 5 and 3
and 11/4
would be
4, 4, 3
Remembe I want as many numbers as I can equal to eachother so its a true split |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 02:51 AM |
| DevVince Im sorry if you feel that way. |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 05 Jun 2016 02:53 AM |
Once again you're acting dumb.
You asked for help I joined to help test I left because you where afk and I couldn't move then you thumbs down all my games because I tried to help you.
So yes that's it there is no feel it's a fact.
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 02:54 AM |
| im not dumb. You came to test, left after like 30 seconds and thumbs it down. I know you did. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:01 AM |
| It needs some sort of trial and error algorithm i think |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:04 AM |
| And DevVince I know why you really arent helping. Its cause your ego is to high to say that you dont know how |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 05 Jun 2016 03:07 AM |
Sorry but you won't ever receive help form me again. I joined your game to help you test it you where afk I played for a few minuets and left because I was stuck on a spawn and you where gone, then you assume I thumbs it down and thumbs down all my places.
And yes I did 15 about minuets ago because you tried to act like it never happened.
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:10 AM |
| As I said, you dont know how to do this therefore I dont need your help. |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 05 Jun 2016 03:12 AM |
So arrogant it's starting to become funny how low of an IQ you have. xD
#It'sSoStupidIt'sFunny
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:12 AM |
Flux_Capacitor where are you!
just to clarify.
11/4
3,3,3,2
13/5
3,3,3,2,2
18/4
5,5,4,4 |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:13 AM |
| I think its funny that you laugh at that sort of thing. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:16 AM |
i think I figured it out. and DevVince I really dont want to fight with you. I think we can both admit we thumbed eachothers places down. And we can both undo it if we want. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:40 AM |
| every integre is devisable by 2,3,5,7 so you split it according to those |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 05 Jun 2016 03:41 AM |
Shh don't tell him about prime numbers..
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:45 AM |
I used a system like this:
13/5
math.floor(13/5+.5) >3
3*5
or
3+3+3+3+3
then I found diffrence
15-13
and made a loop subtract 1 from each
:) if there is faster way let me know |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Jun 2016 04:13 AM |
local colors = {"Bright blue", "Bright yellow"} for i, v in ipairs(game.Workspace.TheCoderOfLuaEel:GetChildren()) do v.BrickColor = BrickColor.new(colors[i%colors+1]) end
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 04:25 AM |
Why not
sets = {group1 = {}, group2 = {}, group3 = {}}
x = 1 for i,v in pairs(whatever)do table.insert(sets[x], v) x = x > 4 and x + 1 or 1 end
WolfgangVonPrinz // Private Drive - Residents Only |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 05 Jun 2016 04:27 AM |
x = x <=#sets and x + 1 or 1
You hardcoded x>4 which won't work if OP changed the number of groups |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 04:32 AM |
Silly me. That was why I put them in a group of sets in the first place :P
Thanks for catching that though
WolfgangVonPrinz // Private Drive - Residents Only |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 04:33 AM |
"Shh don't tell him about prime numbers.." ???? |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 01:58 PM |
| Well are those systems better then mine |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 02:01 PM |
get remainder and make it color of first chain circle color
for example
9 circles, first one yellow remainder of 1, 4 sets of yellow blue
so it would go y,b,y,b,y,b,y,b and the last one would yellow since it starts with yellow
|
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 05:35 PM |
My system is probably best cuz less hard coding
WolfgangVonPrinz // Private Drive - Residents Only |
|
|
| Report Abuse |
|
|