forked from uberalex/spacepirates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (24 loc) · 747 Bytes
/
main.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
import pygame, sys
from renderer import GameCanvas
from engine import GameEngine
from pygame.locals import *
import random
pygame.init()
FPS = 5
fpsClock = pygame.time.Clock()
canvas = GameCanvas()
gameengine = GameEngine()
while True:
canvas.renderBoard(gameengine)
canvas.renderShip(gameengine.ship)
#move the ship about
gameengine.moveShip('Player',random.randint(0,7),random.randint(0,7))
for event in pygame.event.get():
if (event.type == KEYDOWN):
pressed = pygame.key.name(event.key)
print 'pressed ' + pressed
elif event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
fpsClock.tick(FPS)