forked from mitkrieg/Gravity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transitions.py
102 lines (80 loc) · 2.53 KB
/
transitions.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env python
import pygame
from system import *
from pygame.locals import *
from pygame.sprite import Sprite
class Intro(Sprite):
def __init__(self,x,y,group,image=str('title.png')):
Sprite.__init__(self)
self.image = load_graphics(image)
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.group = group
self.starting = False
self.instructions = False
self.add(group)
def update(self):
if self.starting and self.rect.y > -750:
self.rect.y -= 50
elif self.instructions and self.rect.x > -1000:
self.rect.x -= 50
elif not self.instructions and self.rect.x < 0:
self.rect.x += 50
def next_level(self):
if self.starting and self.rect.y > -750:
return False
elif self.starting:
self.kill()
return True
else:
return False
def begin(self):
self.starting = True
def instruct(self,boo):
if boo:
self.instructions = True
else:
self.instructions = False
class Instructions(Intro):
def __init__(self,x,y,group,image=str('instructions.png')):
Intro.__init__(self,x,y,group,image)
class Transition(Sprite):
def __init__(self,x,y,surface,group,image=str('transition.png')):
Sprite.__init__(self)
self.image = load_graphics(image)
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.surface = surface
self.move = False
self.group = group
def update(self):
if self.rect.x < 1005:
self.rect.x += 60
def over(self):
if self.rect.x > 1005:
return True
else:
return False
def reset(self,x):
self.rect.x = x
def add_to_group(self):
self.add(self.group)
class GameOverScreen(Sprite):
image = None
def __init__(self,x,y,surface,image=str('gameover.png')):
Sprite.__init__(self)
if self.image == None:
self.image = load_graphics(image)
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.surface = surface
def update(self):
pass
def draw(self):
self.surface.blit(self.image,(self.rect.x,self.rect.y))
class WinScreen(GameOverScreen):
def __init__(self,x,y,surface,image=str('won.png')):
GameOverScreen.__init__(self,x,y,surface,image)