I am trying to move my boss sprite back and forth but it only moves left and stay there what is the problem with my code.
def horizontal_movement(self):
self.rect.x-=1
if self.rect.left<0: #when boss reaches extreme left
self.rect.x+=1 #move right
if self.rect.right==screen_width: #when boss reaches extreme right
self.rect-=1 #move left
if self.rect.midbottom==[boss_x,boss_y]: #stop the motion when boss reaches original position
pass