Alright, so, made some more progress with the office
Within fnaf, They have lots of gameplay systems that loop together to make the game difficult.
Where am I getting? simple.
After beating such a difficult night in my game, you now have a victory screen.
The 6 am win screen
import pygame
class WinScreen:
def __init__(self):
self.font_big = pygame.font.Font(None, 120)
self.font_small = pygame.font.Font(None, 60)
self.text = self.font_big.render("6 AM", True, (255, 255, 255))
self.text_rect = self.text.get_rect(center=(400, 300))
self.subtext = self.font_small.render("Night Complete", True, (255, 255, 255))
self.subtext_rect = self.subtext.get_rect(center=(400, 420))
# Fade-in overlay
self.alpha = 255
self.fade_speed = 2
self.black = pygame.Surface((800, 800))
self.black.fill((0, 0, 0))
def handle_events(self, events):
# Click to return to title screen
from scenes.title import TitleScreen
for e in events:
if e.type == pygame.MOUSEBUTTONDOWN:
return TitleScreen()
def update(self, dt):
if self.alpha > 0:
self.alpha -= self.fade_speed
if self.alpha < 0:
self.alpha = 0
def draw(self, screen):
screen.fill((0, 0, 0))
screen.blit(self.text, self.text_rect)
screen.blit(self.subtext, self.subtext_rect)
if self.alpha > 0:
self.black.set_alpha(self.alpha)
screen.blit(self.black, (0, 0))
With this large block of code, (Which only took me 30-25 mins), i made a victory screen for beating the night, and made it a gameplay loop for the future.
It was difficult trying to figure out how to get it to loop in the first place, but with these time fructions, and setting requirements for when the victory screen can be visible, it works perfectly fine.
from win_screen import WinScreen
if self.timer.reached_6am():
return WinScreen()
Next time I work on this, I plan to add a power system to this game, so that way the player needs to manage power whilst dealing with the threats heading their way.