I am well aware of how terrible the SettingsMenu class is, it's still a work in progress and is the way it is so it can actually work.
Can't paste it directly in the post because it would be mostly code.
I feel like this function needs work, but I've been over it a couple times and can't find anything meaningful to do.
def title_screen():
background = assets_base_path + 'title_screen.png'
font_size = 0
frames = 0
enter_game = False
while not enter_game:
for event_ in pygame.event.get():
if event_.type == pygame.QUIT:
quit()
elif event_.type == pygame.KEYDOWN:
if event_.key == pygame.K_KP_ENTER or pygame.K_SPACE:
enter_game = True
# print(event_)
game_display.blit(pygame.image.load(background), (0, 0))
font = pygame.font.Font(fonts_path + 'Futura.ttf', font_size)
game_display.blit(font.render(str('An RPG'), True, Color.Black), (500, 111))
# game_display.blit(font.render(str(frames), True, Color.Goldenrod), (0, 0))
if font_size < 65: font_size += 1
if font_size == 65:
game_display.blit(font.render(str('Press Enter To Play'), True, Color.Black), (345, 400))
pygame.display.update()
frames += 1
sleep(0.013)
I also feel like there's room to improve in this section. Seems like there should be a better way to do it, but I'm not sure what it would be.
rect_ = copy(player)
if active_keys['w']: rect_.y -= config.player_movespeed_vertical
if active_keys['s']: rect_.y += config.player_movespeed_vertical
if active_keys['a']: rect_.x -= config.player_movespeed_horizontal
if active_keys['d']: rect_.x += config.player_movespeed_horizontal
rect_.refresh_rect()
pillar_player_collisions_list = pygame.sprite.spritecollide(rect_, active_pillars, False)
wall_player_collisions_list = pygame.sprite.spritecollide(rect_, active_walls, False)
if len(pillar_player_collisions_list + wall_player_collisions_list) != 0:
# print('Collisions With Pillars')
pass
else:
# print('No Collisions With Pillars')
if active_keys['w']: player.y -= config.player_movespeed_vertical
if active_keys['s']: player.y += config.player_movespeed_vertical
if active_keys['a']: player.x -= config.player_movespeed_horizontal
if active_keys['d']: player.x += config.player_movespeed_horizontal
player.refresh_rect()
Thanks!