My problem: My goal is to create a variable that is a line of code that later on I can just call the variable other than just using that line of code (making the code neater). Comment: ball_x_pos and ball_y_pos change in the code
My current code:
CASE_1 = ball_y_pos + RADIUS >= WINDOW_HEIGHT # Hitting bottom floor(need to increase Y)
CASE_2 = ball_y_pos - RADIUS <= 0 # Hitting top floor(need to decrease Y)
CASE_3 = ball_x_pos + RADIUS >= WINDOW_WIDTH # Hitting right side(need to decrease X)
CASE_4 = ball_x_pos - RADIUS <= 0 # Hitting left side(need to decrease X)
if CASE_1: # Ball it hitting the bottom floor
Y_CHANGER = 1
if CASE_2: # Ball is hitting the top floor
Y_CHANGER = -1
if CASE_3: # Ball is hitting the right side
X_CHANGER = -1
if CASE_4:
X_CHANGER = 1
What I think is happening: I'm pretty sure that right now the code is defining the values of the cases as False on assignment. I was wondering if there is any way I can still do this. Thanks in advance!