Ok, I'll get to that But now I'm too frusterated xP
I got this other problem, which prolly has a simple reason, I just can't figure it out, since I'm frusterated and at work xP
anyways here's the code...
and it is called like sendDir() -> chooseDir() -> Move(), now I'm sure one of this is doing it, prolly chooseDir(), 'cause the game crashes when I press Space, which executes this
Code:
void Cball::sendDir(){
int choice = chooseDir();
if(choice == 1) move(POSITIVE);
if(choice == 2) move(NEGATIVE);
}
Code:
int Cball::chooseDir(){
int random_integer;
vector<int> randVec;
for(int i = 0; i<20; ++i){
random_integer = (rand()%2)+1;
randVec.push_back(random_integer);
}
int twos = 0, ones = 0;
for(int i = 0; i != randVec.size(); ++i){
if(randVec[i] == 1) ++ones;
if(randVec[i] == 2) ++twos;
}
if(ones > twos) return 1;
else return 2;
}
Code:
void Cball::move(enum posNeg xDir){
while(inAir){
x = (x + speed) * xDir;
}
}