forked from Johnidel/Python-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcredits.py
More file actions
54 lines (44 loc) · 1.96 KB
/
Copy pathcredits.py
File metadata and controls
54 lines (44 loc) · 1.96 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
import pygame
class Credits:
def __init__(self, handler):
self.handler = handler
#Imports icons
self.title = pygame.transform.scale2x(pygame.image.load("res/211title.png")).convert_alpha()
self.bgImg = pygame.image.load("res/menubg.png").convert_alpha()
self.back = pygame.image.load("res/backicon.png")
alpha = 30
self.title.fill((255, 255, 255, alpha), None, pygame.BLEND_RGBA_MULT)
#Defines font used in text
title_font = pygame.font.SysFont("rockwell", 48, True, True)
position_font = pygame.font.SysFont("timesnewroman", 24)
font = pygame.font.SysFont("timesnewroman", 18)
#Defines text to be printed onto screen
self.credits = title_font.render("Credits", 1, (100,0,0))
self.strings = []
self.strings.append(position_font.render("Lead Programmer", 1, (0, 0, 0)))
self.strings.append(font.render("John Delaney", 1, (0, 0, 0)))
self.strings.append(position_font.render("Assistant Lead Programmer", 1, (0, 0, 0)))
self.strings.append(font.render("Chirayu Poudel", 1, (0, 0, 0)))
self.strings.append(position_font.render("Graphic Designer", 1, (0, 0, 0)))
self.strings.append(font.render("Brandon Ng", 1, (0, 0, 0)))
self.strings.append(position_font.render("Programming", 1, (0, 0, 0)))
self.strings.append(font.render("Tristan Hartwell", 1, (0, 0, 0)))
self.strings.append(font.render("Max Hasenauer", 1, (0, 0, 0)))
self.strings.append(font.render("Brandon Ng", 1, (0, 0, 0)))
#Draws background and back button
def draw(self, screen):
screen.blit(self.bgImg, (0, 0))
screen.blit(self.title, (180, 180))
screen.blit(self.credits, (420,50))
screen.blit(self.back, (400, 600))
#Spaces out the text in the instruction
y = 175
for ele in self.strings:
screen.blit(ele, (100, y))
y += 30
#Checks to see if mouse passes over back button rectangle
def update(self):
rect = self.back.get_rect().move(400,600)
if rect.collidepoint(pygame.mouse.get_pos()):
if pygame.mouse.get_pressed()[0]:
self.handler.curState = 0