-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScenes.py
More file actions
32 lines (21 loc) · 885 Bytes
/
Scenes.py
File metadata and controls
32 lines (21 loc) · 885 Bytes
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
import pygame
from CONSTANTS import *
class Scene(object):
def __init__(self, mainSurface):
self.mainSurface = mainSurface
self._background = None
self.images = []
def update_Scene(self, *spriteGroups):
self.mainSurface.fill(BLACK)
if self._background != None:
self.mainSurface.blit(self._background, (0, 0))
for spriteGroup in spriteGroups:
spriteGroup.update()
spriteGroup.draw(self.mainSurface)
for image, position in self.images:
self.mainSurface.blit(image, position) #position variabel
self.images = []
def enable_Background(self, backgroundImage):
self._background = pygame.image.load(backgroundImage).convert()
def add_sprite(self, sprite, position):
self.images.append((sprite, position))