0
\$\begingroup\$
import pygame
pygame.init()

SREEN_WIDTH = 1920
SCREEN_HEIGHT = 1080

screen = pygame.display.set_mode((SREEN_WIDTH, SCREEN_HEIGHT))

border = pygame.image.load("border.png").convert_alpha()

cursor_image = pygame.image.load('mouse.png')

text = pygame.image.load("TEXT.png").convert_alpha()

player = pygame.Rect((300, 250, 30, 30))

run = True
while run:/

    cursor_xy = pygame.mouse.get_pos()

    pygame.mouse.set_visible(False)

    screen.fill ((0,163,100))

    screen.blit(text, (900,500))

    screen.blit(border, (0,0))

    pygame.draw.rect(screen, (255, 0, 0), player)

    key = pygame.key.get_pressed()
    if key[pygame.K_a] == True:
        player.move_ip(-3,0)
    if key[pygame.K_d] == True:
        player.move_ip(3,0)
    if key[pygame.K_w] == True:
        player.move_ip(0,-3)
    if key[pygame.K_s] == True:
        player.move_ip(0,3)

    screen.blit(cursor_image, cursor_xy)

    for event in pygame.event.get():
        if key[pygame.K_e] == True:
            run = False
    pygame.display.update()



pygame.quit()
\$\endgroup\$
2
  • \$\begingroup\$ Is your player supposed to be a rectangle? Or are you intending to use an image in future? I ask as they require different approaches (someone's done the heavy lifting here and here). Fundamentally, you have two problems: Working out the angle between the player and the cursor AND rotating the player to that angle. Which are you struggling with? \$\endgroup\$ Commented Apr 11, 2024 at 14:14
  • \$\begingroup\$ i am scrapping this but now its going to be a stationary image in the corner pointing at the mouse pointer \$\endgroup\$ Commented Apr 12, 2024 at 20:05

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.