-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting2.py
More file actions
37 lines (25 loc) · 778 Bytes
/
Copy pathtesting2.py
File metadata and controls
37 lines (25 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pygame
import os
ORIG_IMAGE = [pygame.image.load(os.path.join("Assets", "Sprite-" + "CharSword1" + ".png"))]
WINDOW = pygame.display.set_mode((500, 500))
running = True
coords = (250,250)
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
direction = 0
key_info = pygame.key.get_pressed()
if key_info[pygame.K_UP]:
direction = 0
if key_info[pygame.K_DOWN]:
direction = 90
if key_info[pygame.K_LEFT]:
direction = 270
if key_info[pygame.K_RIGHT]:
direction = 180
WINDOW.fill((50,121,228))
image = pygame.transform.rotate(ORIG_IMAGE[0], direction)
WINDOW.blit(image, tuple(coords))
pygame.display.update()
pygame.quit()