Okay, so basically I have this code for an adventure game, and when the first cutscene is over, I want the player of the game to press 'enter' and then the code would move to the next bit of the game. but the problem is that, when I try to blit the scene, the scene only shows up for a split second and then goes back to the original scene. I also tried to use a while loop, but that did absolutely nothing compared to when I didn't use it. can someone please explain to me what is going on? I cant figure it out myself, and I've searched for a solution for a while now until i decided to post the question here.
Also here's my code for the main loop of the game:
running = True
while running:
screen.fill((211, 211, 211))
# fills the surface with a nice grey color
alphaval -= 20
# makes the screen fade into the scene
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
# setting up the timer for the game
realtime = pygame.time.get_ticks()/1000
# animations start here
# cutscene 1
screen.blit(frame_0, (0, 0))
pygame.draw.rect(screen, (0, 0, 0), (0, 0, 320, 480), 15)
if realtime >= 1:
loading(337, 99)
fadein()
if realtime <= 9 and realtime >= 3:
channel1.play(pygame.mixer.Sound('missions\call.ogg'))
time.sleep(9)
elif realtime >= 9:
screen.blit(frameE_0, (320, 0))
pygame.draw.rect(screen, (0, 0, 0), (320, 0, 320, 480), 15)
if realtime >= 12.5:
screen.blit(dialE, (45, 300))
textbox("hello?", 65, 340)
if realtime >= 14:
textbox("who is this?", 125, 340)
for event in pygame.event.get():
if event.type == pygame.KEYDOWN and realtime >= 14:
if event.key == pygame.K_RETURN:
screen.fill((211, 211, 211))
screen.blit(frame_0, (0, 0))
pygame.draw.rect(screen, (0, 0, 0), (0, 0, 320, 480), 15)
screen.blit(frameE_0, (320, 0))
pygame.draw.rect(screen, (0, 0, 0), (320, 0, 320, 480), 15)
clock.tick(30)
pygame.display.update()