New answers tagged


I have this same problem. The only thing I know is that the win = pygame.display.set_mode((x,y)) is causing the problem


You have to compute the angle of the vector from the player to the mouse. get the mouse position by pygame.mouse.get_pos() and the rectangle (pygame.Rect) around the player (self.rect ): mx, my = pygame.mouse.get_pos() player_rect = self.rect Calculate the vector from the player to the mouse and compute the angle of vector by math.atan2. The y-axis needs ...

Top 50 recent answers are included