I'm making a basic pong game and right now, I need to figure out how to get the value of the paddle (with respect to x) when it's on the left and on the right.
I have an idea of what I might be able to do, but I need some help (I'm new to Python). So here's what I'm thinking:
The width and height of the entire screen that the game would be displayed on is 600 by 600. This I know for a fact. So to get the value of the paddle, in terms of x if it's on the left side, would it look something like this?
def get_left(self):
if (self.x < 300):
return self.x
My reasoning behind this was that if the paddle were on the left side, that would mean that the x value would be LESS THAN the halfway mark of the entire playing screen. Is this on the right track? And I was thinking that for the right side, it would be something similar except, it would be "self.x > 300" in the if statement.
I'm not sure if this is the correct reasoning, but I would appreciate it if I got some feedback!