problem that I've got is that, so I'm creating blocks in my game in block class:
void Block::CreateBlocks() {
int count = 0;
coordinateX[0] = START_FLOOR_X;
coordinateY[0] = START_FLOOR_Y;
width[0] = al_get_bitmap_width(floorbmp);
for (int i = 1; i < MAX_BLOCKS; i++) {
width[i] = (rand() % MAX_RANDOM_X_SIZE) + MIN_RANDOM_X_SIZE;
while (width[i] > MAX_RANDOM_X_SIZE) {
width[i] = (rand() % MAX_RANDOM_X_SIZE) + MIN_RANDOM_X_SIZE;
}
}
for (int i = 1; i < MAX_BLOCKS; i++) {
coordinateX[i] = rand() % START_OF_RIGHT_WALL;
while (coordinateX[i] < WALL_WIDTH || coordinateX[i] + width[i] >= START_OF_RIGHT_WALL) {
coordinateX[i] = rand() % START_OF_RIGHT_WALL;
}
coordinateY[i] = 430 - count * 116;
count++;
}
} Now, I'd like to create class Bonus, where I'll read X,Y position of single block, and then i'll create a Bonus on it. The question is, how I can read these arrays: coordinateX, coordinateY, width from block class in bonus class?
Thanks!