-
Notifications
You must be signed in to change notification settings - Fork 0
/
Turret.py
38 lines (35 loc) · 1.2 KB
/
Turret.py
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
38
import pygame, sys
from pygame.locals import *
pygame.init()
pygame.display.set_caption('TANK FIGHT: GO!')
background = pygame.image.load('background.png')
tank = pygame.image.load('tank.png')
white = (255,64,64)
w = 1200
h = 600
screen = pygame.display.set_mode((w, h))
screen.fill((white))
tankPosX = 50
tankPosY = 100
tankw =335
tankh = 142
while True: # main game loop
screen.fill((white))
screen.blit(background,(0,0))
screen.blit(tank,(tankPosX,tankPosY))
for event in pygame.event.get():
if event.type == KEYDOWN:
if event.key == K_r:
pygame.quit()
sys.exit()
elif event.key == K_d:
tankPosX = tankPosX + 10
#if event.type == QUIT:
# pygame.quit()
# sys.exit()
## if event.type == KEYDOWN:
## if event.key == K_a:
## tankPosX = tankPosX - 10
## elif event.key == K_d:
## tankPosX = tankPosY + 10
pygame.display.update()