-
Notifications
You must be signed in to change notification settings - Fork 0
/
souce.py
30 lines (27 loc) · 867 Bytes
/
souce.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
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
tankPoxY = 100
while True: # main game loop
screen.fill((white))
screen.blit(background,(0,0))
screen.blit(tank,(tankPosX,tankPoxY))
for event in pygame.event.get():
#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()