Player can’t move during a combat

After launching the game, I managed to use the Left, Right, Up and Down arrow keys to move the hero character as expected. However, after the first combat with a villain character, the hero character couldn’t move at all in despite of me trying to press any of the arrow keys.

import pygame
import random

class Hero:
    def __init__(self, image_name, position, window):
        self.image = pygame.image.load(image_name).convert_alpha()
        self.image = pygame.transform.scale(self.image, 
                                            (int(self.image.get_width() * 0.5), 
                                             int(self.image.get_height() * 0.5)))
        self.window = window
        self.position = position
        self.rect = self.image.get_rect(center=self.position) 
        self.max_hp = 100
        self.current_hp = self.max_hp
        
    def move(self): 
        adjusted_position = [
            max(self.image.get_width()/2, min(self.window.get_width() - self.image.get_width()/2, self.position[0])),
            max(self.image.get_height()/2 + 20, min(self.window.get_height()-self.image.get_height()/2, self.position[1]))
        ]
        self.position = adjusted_position
        self.rect.center = round(self.position[0]), round(self.position[1])
            
    def draw(self):
        self.window.fill((127, 127, 127))
        self.window.blit(self.image, (self.position[0] - self.image.get_width()/2, self.position[1] - self.image.get_height()/2))

class Villain:
    def __init__(self, image_path, position, window):
        self.image = pygame.image.load(image_path).convert_alpha()
        self.image = pygame.transform.scale(self.image, 
                                            (int(self.image.get_width() * 0.5), 
                                             int(self.image.get_height() * 0.5)))
        self.position = position
        self.window = window
        self.rect = self.image.get_rect(center=self.position)  
        self.max_hp = 100
        self.current_hp = self.max_hp
        
    def move(self, x_range=(-10, 10), y_range=(-10, 10)):
        self.position[0] += random.randint(*x_range)  
        self.position[1] += random.randint(*y_range)  
        adjusted_position = [
            max(self.image.get_width()/2, min(self.window.get_width() - self.image.get_width()/2, self.position[0])),
            max(self.image.get_height()/2 + 10, min(self.window.get_height() - self.image.get_height()/2, self.position[1]))
        ] 
        self.position = adjusted_position
        self.rect.center = round(self.position[0]), round(self.position[1])
    
    def draw(self):
        self.window.blit(self.image, (self.position[0] - self.image.get_width()/2, self.position[1] - self.image.get_height()/2))
        
class Scene:
    def __init__(self, window):
        self.window = window
        self.hero = Hero('hero.png', [400, 300], self.window)
        self.villains = [Villain('villain.png', [80, 80], self.window),
                         Villain('villain.png', [720, 80], self.window),
                         Villain('villain.png', [80, 520], self.window),
                         Villain('villain.png', [720, 520], self.window)]
        self.current_villain = None
        self.in_combat = False
        
    def check_for_combat(self):
        for villain in self.villains:
            if pygame.math.Vector2(villain.position).distance_to(self.hero.position) < 50:
                self.in_combat = True
                self.current_villain = villain
                return True
        return False
        
    def handle_combat(self): 
            if self.in_combat and self.current_villain:  
                hero_damage = int(input('Enter a number between 0 and 8: '))
                self.current_villain.current_hp -= hero_damage
                if self.current_villain.current_hp <= 0:
                    print("Enemy defeated!")
                    self.villains.remove(self.current_villain)
                    self.in_combat = False
                    self.current_villain = None    
                else:
                    enemy_damage = random.randint(2, 8)
                    self.hero.current_hp -= enemy_damage
                if self.hero.current_hp <= 0:
                    print("Hero fell!")
                    
    def handle_events(self):
        keys = pygame.key.get_pressed()
        move_speed = 2
        if keys[pygame.K_LEFT]:
            self.hero.position[0] -= move_speed
        if keys[pygame.K_RIGHT]:
            self.hero.position[0] += move_speed
        if keys[pygame.K_UP]:
            self.hero.position[1] -= move_speed
        if keys[pygame.K_DOWN]:
            self.hero.position[1] += move_speed
        print(self.hero.position)
        self.hero.move()
        for villain in self.villains:
            villain.move()
        if not self.in_combat:
            if self.check_for_combat():
                return
                
    def draw(self):
        self.window.fill((127, 127, 127))
        self.window.blit(self.hero.image, self.hero.position)
        for villain in self.villains:
            villain.draw()
        pygame.display.update()

class Game:
    def __init__(self):
        pygame.init()
        self.window = pygame.display.set_mode((800, 600))
        self.game_scene = Scene(self.window)
        
    def run(self):
        while True:
            for event in pygame.event.get(): 
                if event.type == pygame.QUIT:  
                    pygame.quit() 
                     
            self.game_scene.handle_events() 
            self.game_scene.handle_combat()
            self.game_scene.draw()

window = pygame.display.set_mode((800, 600))            
game = Game()
game.run() 

My question is: what caused the hero character stop moving after the first encounter? How can I fix it?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật