-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyTutorial.py
More file actions
290 lines (228 loc) · 10.4 KB
/
myTutorial.py
File metadata and controls
290 lines (228 loc) · 10.4 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
'''
Title: Desomnia ( Tutorial Screen )
Author: Long Tieu, Wayne Seto, Ethan
Date:
'''
import pygame
pygame.init() # load the pygame module commands in the program
# Display variables
TITLE = 'DESOMNIA' # Appear in the window title
FPS = 30 # Frames per second
WIDTH = 900
HEIGHT = 500
SCREENDIM = (WIDTH, HEIGHT)
screen = pygame.display.set_mode((WIDTH, HEIGHT))
# Color variables
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREY = (50, 50, 50)
kindred = (205,92,92)
kindblue = (132,112,255)
hostilered = (255, 0, 0)
###
# Create the window
screen = pygame.display.set_mode(SCREENDIM) # Create the main surface where all other assets are placed on top
pygame.display.set_caption(TITLE) # This updates the windows title
screen.fill(BLACK) # Fill the entire surface with the chosen color. Think of fill as erase.
clock = pygame.time.Clock() # starts a clock object to measure time
### --- Codes starts here --- ###
lowopasheet = []
lowopasheet.append("media/dialoguebox01.png")
lowopasheetload = (pygame.image.load(lowopasheet[0]).convert_alpha())
dialoguebox = []
dialoguebox.append("media/dialoguebox01.png")
dialogueboxload = (pygame.image.load(dialoguebox[0]).convert_alpha())
class text():
def __init__(self, x, y, content, fontsize, font="Arial", color=(0, 0, 0)):
self.x = x
self.y = y
self.pos = (self.x, self.y)
self.red = 0
self.green = 0
self.blue = 0
self.color = color
self.content = content
self.fontfam = font
self.fontsize = fontsize
self.font = pygame.font.SysFont(self.fontfam, self.fontsize)
self.surface = self.font.render(self.content, 1, self.color)
def textsetpos(self, x, y):
self.x = x
self.y = y
self.pos = (self.x, self.y)
def gettextpos(self):
return self.pos
def textsetColor(self, color):
self.color = color
self.surface = self.font.render(self.content, 1, self.color)
def getText(self):
return self.surface
### --- Codes starts here --- ###
def tutorialmove():
tit01 = text(100, 70, "MOVEMENT TUTORIAL", 50, "Renogare", WHITE)
x = WIDTH / 2 - tit01.getText().get_width() / 2
y = HEIGHT / 2 - tit01.getText().get_height() / 2 - 200
tit01.textsetpos(x, y)
tut01 = text(100, 70, "Press [ D ] to move LEFT", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut01.getText().get_width() / 2
y = HEIGHT / 2 - tut01.getText().get_height() / 2 - 150
tut01.textsetpos(x, y)
tut02 = text(100, 70, "Press [ A ] to move RIGHT", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut02.getText().get_width() / 2
y = HEIGHT / 2 - tut02.getText().get_height() / 2 - 100
tut02.textsetpos(x, y)
tut03 = text(100, 70, "Press [ W ] to move FORWARD", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut03.getText().get_width() / 2
y = HEIGHT / 2 - tut03.getText().get_height() / 2 - 50
tut03.textsetpos(x, y)
tut04 = text(100, 70, "Press [ S ] to move BACKWARD", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut04.getText().get_width() / 2
y = HEIGHT / 2 - tut04.getText().get_height() / 2 + 0
tut04.textsetpos(x, y)
tut05 = text(100, 70, "Press [ SPACE ] to JUMP", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut05.getText().get_width() / 2
y = HEIGHT / 2 - tut05.getText().get_height() / 2 + 50
tut05.textsetpos(x, y)
exit01 = text(100, 70, "Press [ ESC ] to EXIT INTERACTION PAGE", 35, "Renogare", WHITE)
x = WIDTH / 2 - exit01.getText().get_width() / 2
y = HEIGHT / 2 - exit01.getText().get_height() / 2 + 200
exit01.textsetpos(x, y)
screen.blit(tit01.getText(), tit01.gettextpos())
screen.blit(tut01.getText(), tut01.gettextpos())
screen.blit(tut02.getText(), tut02.gettextpos())
screen.blit(tut03.getText(), tut03.gettextpos())
screen.blit(tut04.getText(), tut04.gettextpos())
screen.blit(tut05.getText(), tut05.gettextpos())
screen.blit(exit01.getText(), exit01.gettextpos())
def tutorialatt():
tit2 = text(100, 70, "ATTACK TUTORIAL", 50, "Renogare", WHITE)
x = WIDTH / 2 - tit2.getText().get_width() / 2
y = HEIGHT / 2 - tit2.getText().get_height() / 2 - 200
tit2.textsetpos(x, y)
tut06 = text(100, 70, "Press [ MOUSE LEFT-CLICK ] to ATTACK", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut06.getText().get_width() / 2
y = HEIGHT / 2 - tut06.getText().get_height() / 2 - 100
tut06.textsetpos(x, y)
tut07 = text(100, 70, "The first click always shoot in a respectable distance ", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut07.getText().get_width() / 2
y = HEIGHT / 2 - tut07.getText().get_height() / 2 - 50
tut07.textsetpos(x, y)
tut08 = text(100, 70, "The second click allows it to shoot even further", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut08.getText().get_width() / 2
y = HEIGHT / 2 - tut08.getText().get_height() / 2
tut08.textsetpos(x, y)
tut09 = text(100, 70, "The third click aka combo can lob [something] ", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut09.getText().get_width() / 2
y = HEIGHT / 2 - tut09.getText().get_height() / 2 + 50
tut09.textsetpos(x, y)
exit02 = text(100, 70, "Press [ ESC ] to EXIT INTERACTION PAGE", 35, "Renogare", WHITE)
x = WIDTH / 2 - exit02.getText().get_width() / 2
y = HEIGHT / 2 - exit02.getText().get_height() / 2 + 200
exit02.textsetpos(x, y)
screen.blit(tit2.getText(), tit2.gettextpos())
screen.blit(tut06.getText(), tut06.gettextpos())
screen.blit(tut07.getText(), tut07.gettextpos())
screen.blit(tut08.getText(), tut08.gettextpos())
screen.blit(tut09.getText(), tut09.gettextpos())
screen.blit(exit02.getText(), exit02.gettextpos())
def tutorialspeatt():
tit3 = text(100, 70, "SPECIAL ATTACK TUTORIAL", 50, "Renogare", WHITE)
x = WIDTH / 2 - tit3.getText().get_width() / 2
y = HEIGHT / 2 - tit3.getText().get_height() / 2 - 200
tit3.textsetpos(x, y)
tut10 = text(100, 70, "Press [ MOUSE RIGHT-CLICK ] to initial special attack", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut10.getText().get_width() / 2
y = HEIGHT / 2 - tut10.getText().get_height() / 2 - 100
tut10.textsetpos(x, y)
tut11 = text(100, 70, "It is considered as the ultimate ", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut11.getText().get_width() / 2
y = HEIGHT / 2 - tut11.getText().get_height() / 2 - 50
tut11.textsetpos(x, y)
tut12 = text(100, 70, "It will use up all the paintnergy", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut12.getText().get_width() / 2
y = HEIGHT / 2 - tut12.getText().get_height() / 2
tut12.textsetpos(x, y)
tut13 = text(100, 70, "The third click aka combo can lob [something] ", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut13.getText().get_width() / 2
y = HEIGHT / 2 - tut13.getText().get_height() / 2 + 50
tut13.textsetpos(x, y)
exit01 = text(100, 70, "Press [ ESC ] to EXIT INTERACTION PAGE", 35, "Renogare", WHITE)
x = WIDTH / 2 - exit01.getText().get_width() / 2
y = HEIGHT / 2 - exit01.getText().get_height() / 2 + 200
exit01.textsetpos(x, y)
screen.blit(tit3.getText(), tit3.gettextpos())
screen.blit(tut10.getText(), tut10.gettextpos())
screen.blit(tut11.getText(), tut11.gettextpos())
screen.blit(tut12.getText(), tut12.gettextpos())
screen.blit(tut13.getText(), tut13.gettextpos())
screen.blit(exit01.getText(), exit01.gettextpos())
def tutorialtech():
tit4 = text(100, 70, "TECHNICAL TUTORIAL", 50, "Renogare", WHITE)
x = WIDTH / 2 - tit4.getText().get_width() / 2
y = HEIGHT / 2 - tit4.getText().get_height() / 2 - 200
tit4.textsetpos(x, y)
tut14 = text(100, 70, "Press [ TAB ] to PAUSE", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut14.getText().get_width() / 2
y = HEIGHT / 2 - tut14.getText().get_height() / 2 - 100
tut14.textsetpos(x, y)
tut15 = text(100, 70, "It is recommended to take a break", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut15.getText().get_width() / 2
y = HEIGHT / 2 - tut15.getText().get_height() / 2 - 50
tut15.textsetpos(x, y)
tut16 = text(100, 70, "after two - one hours of playing", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut16.getText().get_width() / 2
y = HEIGHT / 2 - tut16.getText().get_height() / 2
tut16.textsetpos(x, y)
tut17 = text(100, 70, "The third click aka combo can lob [something] ", 35, "Renogare", WHITE)
x = WIDTH / 2 - tut17.getText().get_width() / 2
y = HEIGHT / 2 - tut17.getText().get_height() / 2 + 50
tut17.textsetpos(x, y)
exit01 = text(100, 70, "Press [ ESC ] to EXIT INTERACTION PAGE", 35, "Renogare", WHITE)
x = WIDTH / 2 - exit01.getText().get_width() / 2
y = HEIGHT / 2 - exit01.getText().get_height() / 2 + 200
exit01.textsetpos(x, y)
screen.blit(tit4.getText(), tit4.gettextpos())
screen.blit(tut14.getText(), tut14.gettextpos())
screen.blit(tut15.getText(), tut15.gettextpos())
screen.blit(tut16.getText(), tut16.gettextpos())
screen.blit(tut17.getText(), tut17.gettextpos())
screen.blit(exit01.getText(), exit01.gettextpos())
running = True
tutoriallevel = 0
starttime = 0
endtime = 0
while running:
for event in pygame.event.get(): # return all inputs and triggers into an array
if event.type == pygame.QUIT: # If the red X was clicked
running = False
pressedKeys = pygame.key.get_pressed()
screen.fill(BLACK)
endtime = pygame.time.get_ticks()
print(tutoriallevel)
if tutoriallevel == 0:
if pressedKeys[pygame.K_e] and endtime - starttime > 1000:
starttime = pygame.time.get_ticks()
tutoriallevel = 1 # switch different tutorial
if tutoriallevel == 1:
tutorialmove()
if pressedKeys[pygame.K_ESCAPE] and endtime - starttime > 1000:
starttime = pygame.time.get_ticks()
tutoriallevel = 0
if tutoriallevel == 2:
tutorialatt()
if pressedKeys[pygame.K_ESCAPE] and endtime - starttime > 1000:
starttime = pygame.time.get_ticks()
tutoriallevel = 0
if tutoriallevel == 3:
tutorialspeatt()
if pressedKeys[pygame.K_ESCAPE] and endtime - starttime > 1000:
starttime = pygame.time.get_ticks()
tutoriallevel = 0
if tutoriallevel == 4:
tutorialtech()
if pressedKeys[pygame.K_ESCAPE] and endtime - starttime > 1000:
starttime = pygame.time.get_ticks()
tutoriallevel = 0
clock.tick(FPS) # pause the game until FPS time is reached
pygame.display.flip()
pygame.quit()