hunar4321 / particle-life

A simple program to simulate artificial life using attraction/reuplsion forces between many particles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Numbers" setting for Red/Green is mixed up.

RealSuperRyn opened this issue · comments

If you set the green particle # to 50 and the red one to 1000, there will be 1000 green particles and 50 red ones.

it also seems that, for me, if you set amount of green or red to zero, the other will be zero as well... its like they rely on one another to turn on

Looks like it's in this code:

void ofApp::restart() {
    if (numberSliderG > 0) { green = CreatePoints(numberSliderR, 100, 250, 10); }
    if (numberSliderR > 0) { red = CreatePoints(numberSliderG, 250, 10, 100); }
    if (numberSliderW > 0) { white = CreatePoints(numberSliderW, 250, 250, 250); }
    if (numberSliderB > 0) { blue = CreatePoints(numberSliderB, 100, 100, 250); }
}

I think it should be:

void ofApp::restart() {
    if (numberSliderG > 0) { green = CreatePoints(numberSliderG, 100, 250, 10); }
    if (numberSliderR > 0) { red = CreatePoints(numberSliderR, 250, 10, 100); }
    if (numberSliderW > 0) { white = CreatePoints(numberSliderW, 250, 250, 250); }
    if (numberSliderB > 0) { blue = CreatePoints(numberSliderB, 100, 100, 250); }
}

fixed