所以我一直在尝试制作片尾画面,但我确实知道怎么做,我看过一些教程,但对我来说没有一个真正有意义。我也尝试过使用我的开始屏幕,但将其调高一点并将其放在不同的位置,但它不起作用。我正在尝试在我的播放器与我的其中一个平台发生碰撞时出现结束屏幕,但我不知道如何制作结束屏幕。
I do not know what to really put here but this is my start screen code
##############################################
#START MENUE
def text_objects(text, font):
textSurface = font.render(text, True, black)
return textSurface, textSurface.get_rect()
def button(msg,x,y,w,h,ic,ac,action=None):
mouse = pygame.mouse.get_pos()
click = pygame.mouse.get_pressed()
#print(click)
if x+w > mouse[0] > x and y+h > mouse[1] > y:
pygame.draw.rect(window, ac,(x,y,w,h))
if click[0] == 1 and action != None:
action()
else:
pygame.draw.rect(window, ic,(x,y,w,h))
smallText = pygame.font.SysFont("comicsansms",20)
textSurf, textRect = text_objects(msg, smallText)
textRect.center = ( (x+(w/2)), (y+(h/2)) )
window.blit(textSurf, textRect)
def quitgame():
pygame.quit()
def game_intro():
intro = True
while intro:
for event in pygame.event.get():
#print(event)
if event.type == pygame.QUIT:
pygame.quit()
quit()
window.fill((255,255,255))
largeText = pygame.font.Font('freesansbold.ttf',115)
TextSurf, TextRect = text_objects("Jump", largeText)
TextRect.center = ((500/2),(500/2))
window.blit(TextSurf, TextRect)
button("GO!",100,350,100,50,green,darkgreen,main_loop)
button("Quit",300,350,100,50,orange,darkred,quitgame)
pygame.display.update()
clock.tick(15)
############################################
Helenr
相关分类