-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsea.py
34 lines (25 loc) · 855 Bytes
/
sea.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
""" Sea display """
import pygame
import ship
class Sea:
"""A Sea play area"""
def __init__(self, width, height, displaySurface):
self.rendering = True
self._display_surf = displaySurface
self.now = 0
self.width = width
self.height = height
self.player_ship = ship.Ship(200, 200, self._display_surf)
def on_loop(self, update_time):
""" Update loop """
self.now += update_time
self.player_ship.on_loop(update_time)
def on_render(self):
""" Render event """
background_color = (56, 56, 255)
self._display_surf.fill(background_color)
self.player_ship.on_render(background_color)
pygame.display.update()
def key_press(self, event):
""" user input test """
self.player_ship.key_press(event)