import pygame import math # Initialize pygame pygame.init() # Screen settings WIDTH, HEIGHT = 800, 600 screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Bichu Follow Mouse") clock = pygame.time.Clock() # Bichu position x, y = WIDTH // 2, HEIGHT // 2 speed = 4 def draw_bichu(surface, x, y, angle): # Triangle shape (bichu-like) size = 15 points = [ (x + math.cos(angle) * size * 2, y + math.sin(angle) * size * 2), (x + math.cos(angle + 2.5) * size, y + math.sin(angle + 2.5) * size), (x + math.cos(angle - 2.5) * size, y + math.sin(angle - 2.5) * size), ] pygame.draw.polygon(surface, (0, 255, 0), points) running = True while running: screen.fill((0, 0, 0)) # Black background for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Mouse position mx, my = pygame.mouse.get_pos() # Direction angle angle = math.atan2(my - y, mx - x) # Move bichu x += math.cos(angle) * speed y += math.sin(angle) * speed # Draw bichu draw_bichu(screen, x, y, angle) pygame.display.update() clock.tick(60) pygame.quit()