Skip to content

Instantly share code, notes, and snippets.

@DavidBuchanan314
Created February 23, 2023 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidBuchanan314/89a723f6a7370053209022f2d12cae36 to your computer and use it in GitHub Desktop.
Save DavidBuchanan314/89a723f6a7370053209022f2d12cae36 to your computer and use it in GitHub Desktop.
import pygame
WHITE = (0xff, 0xff, 0xff)
pygame.init()
screen = pygame.display.set_mode((128, 128))
clock = pygame.time.Clock()
arrow_surface = pygame.surface.Surface((64, 64))
pygame.draw.aaline(arrow_surface, WHITE, (32, 0), (32, 64))
pygame.draw.aaline(arrow_surface, WHITE, (32 - 16, 64 - 16), (32, 64))
pygame.draw.aaline(arrow_surface, WHITE, (32 + 16, 64 - 16), (32, 64))
angle = 0
while True:
screen.fill((0, 0, 0))
#rotated = pygame.transform.rotozoom(arrow_surface, angle, 1.0)
rotated = pygame.transform.rotate(arrow_surface, angle)
screen.blit(rotated, (64 - rotated.get_width() / 2, 64 - rotated.get_height() / 2))
pygame.display.flip()
clock.tick(60)
angle += 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment