fix: fixed collision of pipe where it only did the first and not all pipes

This commit is contained in:
DarthMooMancer
2025-09-04 19:25:16 -04:00
parent 152a2e0a8a
commit f58907eb93
+4 -2
View File
@@ -40,14 +40,16 @@ int main() {
if(pipes.front().m_nodes->m_col < 3) { if(pipes.front().m_nodes->m_col < 3) {
_delete_pipe(pipes); _delete_pipe(pipes);
} }
for(int j = 0; j < pipes.size(); j++) {
for(int i = 0; i < pipes.front().m_size; i++) { for(int i = 0; i < pipes.front().m_size; i++) {
if(pipes.front().m_nodes[i].m_col == bird.m_body.m_col) { if(pipes.at(j).m_nodes[i].m_col == bird.m_body.m_col) {
if(pipes.front().m_nodes[i].m_row == bird.m_body.m_row) { if(pipes.at(j).m_nodes[i].m_row == bird.m_body.m_row) {
running = false; running = false;
std::cout << "You died!" << std::endl; std::cout << "You died!" << std::endl;
} }
} }
} }
}
window.update_display(bird, pipes); window.update_display(bird, pipes);
frames++; frames++;
if(frames > 4) { if(frames > 4) {