-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuperpower.py
More file actions
58 lines (47 loc) · 1.71 KB
/
superpower.py
File metadata and controls
58 lines (47 loc) · 1.71 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pygame
import time
class MachineGun(pygame.sprite.Sprite):
def __init__(self, screen, parent):
super(MachineGun, self).__init__()
self.screen = screen
self.screen_rect = screen.get_rect()
self.image = pygame.image.load("icons/bullets.png")
self.rect = self.image.get_rect()
self.rect.x = parent.rect.x
self.rect.y = parent.rect.y
self.spawn_time = time.time()
def print(self):
self.screen.blit(self.image, self.rect)
def update(self):
if time.time() - self.spawn_time > 5:
self.kill()
class Invincibility(pygame.sprite.Sprite):
def __init__(self, screen, parent):
super(Invincibility, self).__init__()
self.screen = screen
self.screen_rect = screen.get_rect()
self.image = pygame.image.load("icons/invincibility.png")
self.rect = self.image.get_rect()
self.rect.x = parent.rect.x
self.rect.y = parent.rect.y
self.spawn_time = time.time()
def print(self):
self.screen.blit(self.image, self.rect)
def update(self):
if time.time() - self.spawn_time > 5:
self.kill()
class Freeze(pygame.sprite.Sprite):
def __init__(self, screen, parent):
super(Freeze, self).__init__()
self.screen = screen
self.screen_rect = screen.get_rect()
self.image = pygame.image.load("icons/freeze.png")
self.rect = self.image.get_rect()
self.rect.x = parent.rect.x
self.rect.y = parent.rect.y
self.spawn_time = time.time()
def print(self):
self.screen.blit(self.image, self.rect)
def update(self):
if time.time() - self.spawn_time > 5:
self.kill()