fix: properly skips block if deleted and doesnt print the old symbol. removed old helper functions that are redundant

This commit is contained in:
DarthMooMancer
2025-09-01 17:51:36 -04:00
parent f1e32089ae
commit 6529353f2f
5 changed files with 31 additions and 25 deletions
+4 -6
View File
@@ -1,6 +1,5 @@
#include "elements.hpp"
#include "globals.hpp"
#include <iostream>
Point::Point() {
m_row = 0;
@@ -12,10 +11,6 @@ void Point::assign(int row, int col) {
m_col = col;
}
void Point::to_string() {
std::cout << "(" << m_row << ", " << m_col << ")";
}
Paddle::Paddle() {
_size = 3;
m_nodes[0].m_col = 6;
@@ -44,6 +39,7 @@ Ball::Ball() {
m_origin.assign(ROW - 5, (COL / 2));
vx = 1;
vy = -1;
m_blocks_left = 15;
}
void Ball::change_velocity(char d) {
@@ -56,7 +52,7 @@ void Ball::change_velocity(char d) {
}
}
void Ball::check_collision(int &lives) {
void Ball::check_collision() {
if(m_origin.m_row <= 0) {
change_velocity('y');
} if(m_origin.m_col <= 0 || m_origin.m_col >= COL -1) {
@@ -95,6 +91,8 @@ void Block::get_pos() {
void Block::_delete() {
for(int i = 0; i < _size; i++) {
m_nodes[i].assign(ROW - 1, COL - 1);
m_symbol = '.';
_deleted = true;
}
}