Skip to content

Commit

Permalink
added a dummy loading loop
Browse files Browse the repository at this point in the history
  • Loading branch information
bydariogamer committed Dec 25, 2022
1 parent b8e3efa commit b34ad6c
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# INITIALIZE PYGAME
pygame.init()


# WINDOW CONSTANTS
PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
clock = pygame.time.Clock()
Expand Down Expand Up @@ -257,10 +256,8 @@ async def menu_choose_loop():
if level[0].mouseclick():
try:
if mouse_rel:
player = Player(Level(level[1]))
state = "level"
print("-level-")
return
player = level[1]
state = "loading"
except pygame.error:
clic = False
while not clic:
Expand Down Expand Up @@ -346,6 +343,26 @@ async def menu_choose_loop():
await asyncio.sleep(0)


async def loading_loop():
global clock, display, display_rect, game, FONTS, SONGS, state, player
while state == "loading":
for event in pygame.event.get():
if event.type == pygame.QUIT:
state = "close"
if event.type == pygame.VIDEORESIZE:
display_rect = display.get_rect()
config.resize = (
display_rect.w / config.DISP_WID,
display_rect.h / config.DISP_HEI,
)
if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
state = "start"
pygame.mixer.music.unload()

player = Player(Level(player))
state = "level"


async def level_loop():
global clock, display, display_rect, game, FONTS, SONGS, state, player

Expand Down Expand Up @@ -469,6 +486,10 @@ async def main():
if state == "choose":
await menu_choose_loop()

# LOADING SCREEN
if state == "loading":
await loading_loop()

# LEVEL ITSELF
if state == "level":
await level_loop()
Expand Down

0 comments on commit b34ad6c

Please sign in to comment.