-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexit.py
More file actions
23 lines (19 loc) · 745 Bytes
/
Copy pathexit.py
File metadata and controls
23 lines (19 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from levelformat import Exit as e
import os
import pygame
class Exit(pygame.sprite.Sprite):
image = None
def __init__(self, exitFormat):
pygame.sprite.Sprite.__init__(self)
if not Exit.image:
imgpath = os.path.join("assets", "images", "exit.png")
Exit.image = pygame.image.load(imgpath).convert_alpha()
self.image = Exit.image
self.rect = self.image.get_rect()
self.initialpos = self.pos = self.rect.center = exitFormat.rect.center
def update(self, offset):
self.pos = [a + b for a,b in zip(self.pos, offset)]
self.rect.center = self.pos
def reset(self):
self.pos = self.initialpos
self.rect.center = self.initialpos