From 349b0b78db9a2b065d5b0f570fba97ad3079d58a Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Wed, 28 Feb 2024 00:05:05 -0500 Subject: [PATCH] Created method to set position of paddle --- includes/paddle.hpp | 3 +++ paddle.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/includes/paddle.hpp b/includes/paddle.hpp index 962f68a..858acc7 100644 --- a/includes/paddle.hpp +++ b/includes/paddle.hpp @@ -25,6 +25,9 @@ public: /* Increments the number of points that this paddle has earned */ void incrementPoints(); + /* Sets the paddle position */ + void setPosition(int x, int y); + /* Resets the paddle position */ void reset(); diff --git a/paddle.cpp b/paddle.cpp index fcf3304..5e5f0d7 100644 --- a/paddle.cpp +++ b/paddle.cpp @@ -22,6 +22,12 @@ void Paddle::incrementPoints() { return; } +void Paddle::setPosition(int x, int y) { + this->rectangle.x = x; + this->rectangle.y = y; + return; +} + void Paddle::reset() { this->rectangle.x = this->initial_pos.x; this->rectangle.y = this->initial_pos.y;