Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- pygame.init()
- WIDTH, HEIGHT = 640, 480
- BLACK = (0, 0, 0)
- WHITE = (255, 255, 255)
- screen = pygame.display.set_mode((WIDTH, HEIGHT), 0, 32)
- pygame.display.set_caption('Space War')
- FPS = 30
- fps_clock = pygame.time.Clock() # clock is object, Clock is class
- pirate = starship.Ship('pirate ship0', 100, 100, 90)
- while True: # game loop
- screen.fill(WHITE)
- #PROCESSES
- checkForQuit()
- for event in pygame.event.get():
- if event.type == KEYUP:
- print(event.key)
- if event.key in (K_ESCAPE):
- terminate()
- if event.key in (K_k):
- pirate.accelerate()
- if event.key in (K_j):
- pirate.rotate_left(5)
- if event.key in (K_l):
- pirate.rotate_right(5)
- #LOGIC
- pirate.move()
- # if pirate.speed > 1:
- # pirate.speed -= 1 # all ships have drag!
- # else:
- # pirate.speed = 0
- #DRAW
- screen.blit(pirate.image, (pirate.x, pirate.y))
- #DRAW
- pygame.display.update()
- fps_clock.tick(FPS)
- if __name__ == '__main__':
- main()
- Status API Training Shop Blog About
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement