doesn't work properly and i know why it is, but I don't know how to ask in google search + I do not know how to make
1 2 3 4 5
for(int z = 0; z < 5; z++)
{
if(trapX[z] == i && trapY[z] == j)
cout << "T" << " ";
}
this part right. I want to make multiple traps without having to intialize every single one of them and make them stay not to appear and dissapear constantly.
1 2 3 4 5
for(int z = 0; z < 5; z++)
{
trapX[z] = rand() % width;
trapY[z] = rand() % width;
}
This is how I am initializing them. For the record I will need to make them move in the future so Im trying to get an idea here. I did make them move before that but I used cruel method, by initializing every single one of them and making every single variable move seperately.
I'm not sure if I phrased that right and my question is clear but i hope I did.
Yeah, I feel like i kind of hit into the wall. If i want some things to happen I guess i have to remake program from the begining.
And while trying to compile i had an error with 67th code line so I initialized z in the begining of function Draw and at the end of it wrote z++ but it didnt print any of the .......
May I ask you for the logic behind that? Cause now not only they stay in place but i need to press a key to make 1 move which i wanted in the first place.
May I ask you for the logic behind that? Cause now not only they stay in place but i need to press a key to make 1 move which i wanted in the first place.
Soo This is my improved code, I want Traps to move automatically this was my previous logic and it worked before but since its now improved my i ask you to take a look at it? Especially at Trap() part.
how about using correct tabbing to improve readability?
However:
Lines 10-21 contain uninitialized variables. It's better to initialize them directly in the declaration instead of doing it in the Setup function.
How many traps you would have? 5 or 12? Because you declared the arrays trapX and trapY with 5 elements but nTraps value is 12.
Assuming the right value is 12, you should change lines 14-15 in this way:
1 2 3
constint nTraps = 12;
int trapX[nTraps];
int trapY[nTraps];
and in line 32 use nTraps instead of 5.
What direction is SADSAD? I don't think you need it, remove it.
Thanks a lot fcantoro. The purpose of trap Moving was, to make them move randomly. What is wrong with the tabbing? Im new to this site looking forward to your help. :)