鱼C论坛

 找回密码
 立即注册
查看: 434|回复: 3

[已解决]请问这个怎么修改啊?就是缩进不对

[复制链接]
发表于 2020-5-25 17:39:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 1q2w3easxz 于 2020-5-25 17:44 编辑

# 1 - Import library
import math
import pygame
from pygame.locals import *
import random

# 2 - Initialize the game
pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode((width, height))
keys = [False, False, False, False]
playerpos=[100,100]
acc=[0,0]
arrows=[]
badtimer=100
badtimer1=0
badguys=[[640,100]]
healthvalue=194
pygame.mixer.init()

# 3 - Load images
player = pygame.image.load("resources/images/dude.png")
grass = pygame.image.load("resources/images/grass.png")
castle = pygame.image.load("resources/images/castle.png")
badguyimg1 = pygame.image.load("resources/images/badguy.png")
badguyimg=badguyimg1
healthbar = pygame.image.load("resources/images/healthbar.png")
health = pygame.image.load("resources/images/health.png")
gameover = pygame.image.load("resources/images/gameover.png")
youwin = pygame.image.load("resources/images/youwin.png")
# 3.1 - Load audio
hit = pygame.mixer.Sound("resources/audio/explode.wav")
enemy = pygame.mixer.Sound("resources/audio/enemy.wav")
shoot = pygame.mixer.Sound("resources/audio/shoot.wav")
hit.set_volume(0.05)
enemy.set_volume(0.05)
shoot.set_volume(0.05)
pygame.mixer.music.load('resources/audio/moonlight.wav')
pygame.mixer.music.play(-1, 0.0)
pygame.mixer.music.set_volume(0.25)

# 4 - keep looping through
running = 1
exitcode = 0
while running:
    badtimer-=1
# 5 - clear the screen before drawing it again
    screen.fill(0)
# 6 - draw the screen elements
    for x in range(width/grass.get_width()+1):
        for y in range(height/grass.get_height()+1):
            screen.blit(grass,(x*100,y*100))
    screen.blit(castle,(0,30))
    screen.blit(castle,(0,135))
    screen.blit(castle,(0,240))
    screen.blit(castle,(0,345 ))
    screen.blit(player, playerpos)
    # 6.1 - Set player position and rotation
    position = pygame.mouse.get_pos()
    angle = math.atan2(position[1]-(playerpos[1]+32),position[0]-(playerpos[0]+26))
    playerrot = pygame.transform.rotate(player, 360-angle*57.29)
    playerpos1 = (playerpos[0]-playerrot.get_rect().width/2, playerpos[1]-playerrot.get_rect().height/2)
    screen.blit(playerrot, playerpos1)
    # 6.2 - Draw arrows
    for bullet in arrows:
        index=0
        velx=math.cos(bullet[0])*10
        vely=math.sin(bullet[0])*10
        bullet[1]+=velx
        bullet[2]+=vely
        if bullet[1]<-64 or bullet[1]>640 or bullet[2]<-64 or bullet[2]>480:
            arrows.pop(index)
        index+=1
        for projectile in arrows:
            arrow1 = pygame.transform.rotate(arrow, 360-projectile[0]*57.29)
            screen.blit(arrow1, (projectile[1], projectile[2]))
     # 6.3 - Draw badgers
    if badtimer==0:
        badguys.append([640, random.randint(50,430)])
        badtimer=100-(badtimer1*2)
        if badtimer1>=35:
            badtimer1=35
        else:
            badtimer1+=5
    index=0
    for badguy in badguys:
        if badguy[0]<-64:
            badguys.pop(index)
        badguy[0]-=7
    # 6.3.1 - Attack castle
        badrect=pygame.Rect(badguyimg.get_rect())
        badrect.top=badguy[1]
        badrect.left=badguy[0]
        if badrect.left<64:
            hit.play()
            healthvalue -= random.randint(5,20)
            badguys.pop(index)
    #6.3.2 - Check for collisions
        index1=0
        for bullet in arrows:
            bullrect=pygame.Rect(arrow.get_rect())
            bullrect.left=bullet[1]
            bullrect.top=bullet[2]
            if badrect.colliderect(bullrect):
                enemy.play()
                acc[0]+=1
                badguys.pop(index)
                arrows.pop(index1)
            index1+=1
    # 6.3.3 - Next bad guy
        index+=1
    for badguy in badguys:
        screen.blit(badguyimg, badguy)
     # 6.4 - Draw clock
    font = pygame.font.Font(None, 24)
    survivedtext = font.render(str((90000-pygame.time.get_ticks())/60000)+":"+str((90000-pygame.time.get_ticks())/1000%60).zfill(2), True, (0,0,0))
    textRect = survivedtext.get_rect()
    textRect.topright=[635,5]
    screen.blit(survivedtext, textRect)
    # 6.5 - Draw health bar
    screen.blit(healthbar, (5,5))
    for health1 in range(healthvalue):
        screen.blit(health, (health1+8,8))
# 7 - update the screen
    pygame.display.flip()
# 8 - loop through the events
    for event in pygame.event.get():
        # check if the event is the X button
        if event.type==pygame.QUIT:
            # if it is quit the game
            pygame.quit()
            exit(0)
         if event.type == pygame.KEYDOWN:
            if event.key==K_w:
                keys[0]=True
            elif event.key==K_a:
                keys[1]=True
            elif event.key==K_s:
                keys[2]=True
            elif event.key==K_d:
                keys[3]=True
        if event.type == pygame.KEYUP:
            if event.key==pygame.K_w:
                keys[0]=False
            elif event.key==pygame.K_a:
                keys[1]=False
            elif event.key==pygame.K_s:
                keys[2]=False
            elif event.key==pygame.K_d:
                keys[3]=False
            if event.type==pygame.MOUSEBUTTONDOWN:
                shoot.play()
                position=pygame.mouse.get_pos()
                 cc[1]+=1
                arrows.append([math.atan2(position[1]-(playerpos1[1]+32),position[0]-(playerpos1[0]+26)),playerpos1[0]+32,playerpos1[1]+32])
# 9 - Move player
    if keys[0]:
        playerpos[1]-=5
    elif keys[2]:
        playerpos[1]+=5
    if keys[1]:
        playerpos[0]-=5
    elif keys[3]:
        playerpos[0]+=5
#10 - Win/Lose check
    if pygame.time.get_ticks()>=90000:
        running=0
        exitcode=1
    if healthvalue<=0:
        running=0
        exitcode=0
    if acc[1]!=0:
        accuracy=acc[0]*1.0/acc[1]*100
    else:
        accuracy=0
# 11 - Win/lose display        
if exitcode==0:
    pygame.font.init()
    font = pygame.font.Font(None, 24)
    text = font.render("Accuracy: "+str(accuracy)+"%", True, (255,0,0))
    textRect = text.get_rect()
    textRect.centerx = screen.get_rect().centerx
    textRect.centery = screen.get_rect().centery+24
    screen.blit(gameover, (0,0))
    screen.blit(text, textRect)
else:
    pygame.font.init()
    font = pygame.font.Font(None, 24)
    text = font.render("Accuracy: "+str(accuracy)+"%", True, (0,255,0))
    textRect = text.get_rect()
    textRect.centerx = screen.get_rect().centerx
    textRect.centery = screen.get_rect().centery+24
    screen.blit(youwin, (0,0))
    screen.blit(text, textRect)
while 1:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            exit(0)
    pygame.display.flip()
最佳答案
2020-5-25 17:46:40
  1. # 1 - Import library
  2. import math
  3. import pygame
  4. from pygame.locals import *
  5. import random

  6. # 2 - Initialize the game
  7. pygame.init()
  8. width, height = 640, 480
  9. screen=pygame.display.set_mode((width, height))
  10. keys = [False, False, False, False]
  11. playerpos=[100,100]
  12. acc=[0,0]
  13. arrows=[]
  14. badtimer=100
  15. badtimer1=0
  16. badguys=[[640,100]]
  17. healthvalue=194
  18. pygame.mixer.init()

  19. # 3 - Load images
  20. player = pygame.image.load("resources/images/dude.png")
  21. grass = pygame.image.load("resources/images/grass.png")
  22. castle = pygame.image.load("resources/images/castle.png")
  23. badguyimg1 = pygame.image.load("resources/images/badguy.png")
  24. badguyimg=badguyimg1
  25. healthbar = pygame.image.load("resources/images/healthbar.png")
  26. health = pygame.image.load("resources/images/health.png")
  27. gameover = pygame.image.load("resources/images/gameover.png")
  28. youwin = pygame.image.load("resources/images/youwin.png")
  29. # 3.1 - Load audio
  30. hit = pygame.mixer.Sound("resources/audio/explode.wav")
  31. enemy = pygame.mixer.Sound("resources/audio/enemy.wav")
  32. shoot = pygame.mixer.Sound("resources/audio/shoot.wav")
  33. hit.set_volume(0.05)
  34. enemy.set_volume(0.05)
  35. shoot.set_volume(0.05)
  36. pygame.mixer.music.load('resources/audio/moonlight.wav')
  37. pygame.mixer.music.play(-1, 0.0)
  38. pygame.mixer.music.set_volume(0.25)

  39. # 4 - keep looping through
  40. running = 1
  41. exitcode = 0
  42. while running:
  43.     badtimer-=1
  44. # 5 - clear the screen before drawing it again
  45.     screen.fill(0)
  46. # 6 - draw the screen elements
  47.     for x in range(width/grass.get_width()+1):
  48.         for y in range(height/grass.get_height()+1):
  49.             screen.blit(grass,(x*100,y*100))
  50.     screen.blit(castle,(0,30))
  51.     screen.blit(castle,(0,135))
  52.     screen.blit(castle,(0,240))
  53.     screen.blit(castle,(0,345 ))
  54.     screen.blit(player, playerpos)
  55.     # 6.1 - Set player position and rotation
  56.     position = pygame.mouse.get_pos()
  57.     angle = math.atan2(position[1]-(playerpos[1]+32),position[0]-(playerpos[0]+26))
  58.     playerrot = pygame.transform.rotate(player, 360-angle*57.29)
  59.     playerpos1 = (playerpos[0]-playerrot.get_rect().width/2, playerpos[1]-playerrot.get_rect().height/2)
  60.     screen.blit(playerrot, playerpos1)
  61.     # 6.2 - Draw arrows
  62.     for bullet in arrows:
  63.         index=0
  64.         velx=math.cos(bullet[0])*10
  65.         vely=math.sin(bullet[0])*10
  66.         bullet[1]+=velx
  67.         bullet[2]+=vely
  68.         if bullet[1]<-64 or bullet[1]>640 or bullet[2]<-64 or bullet[2]>480:
  69.             arrows.pop(index)
  70.         index+=1
  71.         for projectile in arrows:
  72.             arrow1 = pygame.transform.rotate(arrow, 360-projectile[0]*57.29)
  73.             screen.blit(arrow1, (projectile[1], projectile[2]))
  74.      # 6.3 - Draw badgers
  75.     if badtimer==0:
  76.         badguys.append([640, random.randint(50,430)])
  77.         badtimer=100-(badtimer1*2)
  78.         if badtimer1>=35:
  79.             badtimer1=35
  80.         else:
  81.             badtimer1+=5
  82.     index=0
  83.     for badguy in badguys:
  84.         if badguy[0]<-64:
  85.             badguys.pop(index)
  86.         badguy[0]-=7
  87.     # 6.3.1 - Attack castle
  88.         badrect=pygame.Rect(badguyimg.get_rect())
  89.         badrect.top=badguy[1]
  90.         badrect.left=badguy[0]
  91.         if badrect.left<64:
  92.             hit.play()
  93.             healthvalue -= random.randint(5,20)
  94.             badguys.pop(index)
  95.     #6.3.2 - Check for collisions
  96.         index1=0
  97.         for bullet in arrows:
  98.             bullrect=pygame.Rect(arrow.get_rect())
  99.             bullrect.left=bullet[1]
  100.             bullrect.top=bullet[2]
  101.             if badrect.colliderect(bullrect):
  102.                 enemy.play()
  103.                 acc[0]+=1
  104.                 badguys.pop(index)
  105.                 arrows.pop(index1)
  106.             index1+=1
  107.     # 6.3.3 - Next bad guy
  108.         index+=1
  109.     for badguy in badguys:
  110.         screen.blit(badguyimg, badguy)
  111.      # 6.4 - Draw clock
  112.     font = pygame.font.Font(None, 24)
  113.     survivedtext = font.render(str((90000-pygame.time.get_ticks())/60000)+":"+str((90000-pygame.time.get_ticks())/1000%60).zfill(2), True, (0,0,0))
  114.     textRect = survivedtext.get_rect()
  115.     textRect.topright=[635,5]
  116.     screen.blit(survivedtext, textRect)
  117.     # 6.5 - Draw health bar
  118.     screen.blit(healthbar, (5,5))
  119.     for health1 in range(healthvalue):
  120.         screen.blit(health, (health1+8,8))
  121. # 7 - update the screen
  122.     pygame.display.flip()
  123. # 8 - loop through the events
  124.     for event in pygame.event.get():
  125.         # check if the event is the X button
  126.         if event.type==pygame.QUIT:
  127.             # if it is quit the game
  128.             pygame.quit()
  129.             exit(0)
  130.         if event.type == pygame.KEYDOWN:
  131.             if event.key==K_w:
  132.                 keys[0]=True
  133.             elif event.key==K_a:
  134.                 keys[1]=True
  135.             elif event.key==K_s:
  136.                 keys[2]=True
  137.             elif event.key==K_d:
  138.                 keys[3]=True
  139.         if event.type == pygame.KEYUP:
  140.             if event.key==pygame.K_w:
  141.                 keys[0]=False
  142.             elif event.key==pygame.K_a:
  143.                 keys[1]=False
  144.             elif event.key==pygame.K_s:
  145.                 keys[2]=False
  146.             elif event.key==pygame.K_d:
  147.                 keys[3]=False
  148.             if event.type==pygame.MOUSEBUTTONDOWN:
  149.                 shoot.play()
  150.                 position=pygame.mouse.get_pos()
  151.                 cc[1]+=1
  152.                 arrows.append([math.atan2(position[1]-(playerpos1[1]+32),position[0]-(playerpos1[0]+26)),playerpos1[0]+32,playerpos1[1]+32])
  153. # 9 - Move player
  154.     if keys[0]:
  155.         playerpos[1]-=5
  156.     elif keys[2]:
  157.         playerpos[1]+=5
  158.     if keys[1]:
  159.         playerpos[0]-=5
  160.     elif keys[3]:
  161.         playerpos[0]+=5
  162. #10 - Win/Lose check
  163.     if pygame.time.get_ticks()>=90000:
  164.         running=0
  165.         exitcode=1
  166.     if healthvalue<=0:
  167.         running=0
  168.         exitcode=0
  169.     if acc[1]!=0:
  170.         accuracy=acc[0]*1.0/acc[1]*100
  171.     else:
  172.         accuracy=0
  173. # 11 - Win/lose display        
  174. if exitcode==0:
  175.     pygame.font.init()
  176.     font = pygame.font.Font(None, 24)
  177.     text = font.render("Accuracy: "+str(accuracy)+"%", True, (255,0,0))
  178.     textRect = text.get_rect()
  179.     textRect.centerx = screen.get_rect().centerx
  180.     textRect.centery = screen.get_rect().centery+24
  181.     screen.blit(gameover, (0,0))
  182.     screen.blit(text, textRect)
  183. else:
  184.     pygame.font.init()
  185.     font = pygame.font.Font(None, 24)
  186.     text = font.render("Accuracy: "+str(accuracy)+"%", True, (0,255,0))
  187.     textRect = text.get_rect()
  188.     textRect.centerx = screen.get_rect().centerx
  189.     textRect.centery = screen.get_rect().centery+24
  190.     screen.blit(youwin, (0,0))
  191.     screen.blit(text, textRect)
  192. while 1:
  193.     for event in pygame.event.get():
  194.         if event.type == pygame.QUIT:
  195.             pygame.quit()
  196.             exit(0)
  197.     pygame.display.flip()
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-5-25 17:43:50 | 显示全部楼层
本帖最后由 1q2w3easxz 于 2020-5-25 17:44 编辑

谁来帮帮我吖
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-5-25 17:46:40 | 显示全部楼层    本楼为最佳答案   
  1. # 1 - Import library
  2. import math
  3. import pygame
  4. from pygame.locals import *
  5. import random

  6. # 2 - Initialize the game
  7. pygame.init()
  8. width, height = 640, 480
  9. screen=pygame.display.set_mode((width, height))
  10. keys = [False, False, False, False]
  11. playerpos=[100,100]
  12. acc=[0,0]
  13. arrows=[]
  14. badtimer=100
  15. badtimer1=0
  16. badguys=[[640,100]]
  17. healthvalue=194
  18. pygame.mixer.init()

  19. # 3 - Load images
  20. player = pygame.image.load("resources/images/dude.png")
  21. grass = pygame.image.load("resources/images/grass.png")
  22. castle = pygame.image.load("resources/images/castle.png")
  23. badguyimg1 = pygame.image.load("resources/images/badguy.png")
  24. badguyimg=badguyimg1
  25. healthbar = pygame.image.load("resources/images/healthbar.png")
  26. health = pygame.image.load("resources/images/health.png")
  27. gameover = pygame.image.load("resources/images/gameover.png")
  28. youwin = pygame.image.load("resources/images/youwin.png")
  29. # 3.1 - Load audio
  30. hit = pygame.mixer.Sound("resources/audio/explode.wav")
  31. enemy = pygame.mixer.Sound("resources/audio/enemy.wav")
  32. shoot = pygame.mixer.Sound("resources/audio/shoot.wav")
  33. hit.set_volume(0.05)
  34. enemy.set_volume(0.05)
  35. shoot.set_volume(0.05)
  36. pygame.mixer.music.load('resources/audio/moonlight.wav')
  37. pygame.mixer.music.play(-1, 0.0)
  38. pygame.mixer.music.set_volume(0.25)

  39. # 4 - keep looping through
  40. running = 1
  41. exitcode = 0
  42. while running:
  43.     badtimer-=1
  44. # 5 - clear the screen before drawing it again
  45.     screen.fill(0)
  46. # 6 - draw the screen elements
  47.     for x in range(width/grass.get_width()+1):
  48.         for y in range(height/grass.get_height()+1):
  49.             screen.blit(grass,(x*100,y*100))
  50.     screen.blit(castle,(0,30))
  51.     screen.blit(castle,(0,135))
  52.     screen.blit(castle,(0,240))
  53.     screen.blit(castle,(0,345 ))
  54.     screen.blit(player, playerpos)
  55.     # 6.1 - Set player position and rotation
  56.     position = pygame.mouse.get_pos()
  57.     angle = math.atan2(position[1]-(playerpos[1]+32),position[0]-(playerpos[0]+26))
  58.     playerrot = pygame.transform.rotate(player, 360-angle*57.29)
  59.     playerpos1 = (playerpos[0]-playerrot.get_rect().width/2, playerpos[1]-playerrot.get_rect().height/2)
  60.     screen.blit(playerrot, playerpos1)
  61.     # 6.2 - Draw arrows
  62.     for bullet in arrows:
  63.         index=0
  64.         velx=math.cos(bullet[0])*10
  65.         vely=math.sin(bullet[0])*10
  66.         bullet[1]+=velx
  67.         bullet[2]+=vely
  68.         if bullet[1]<-64 or bullet[1]>640 or bullet[2]<-64 or bullet[2]>480:
  69.             arrows.pop(index)
  70.         index+=1
  71.         for projectile in arrows:
  72.             arrow1 = pygame.transform.rotate(arrow, 360-projectile[0]*57.29)
  73.             screen.blit(arrow1, (projectile[1], projectile[2]))
  74.      # 6.3 - Draw badgers
  75.     if badtimer==0:
  76.         badguys.append([640, random.randint(50,430)])
  77.         badtimer=100-(badtimer1*2)
  78.         if badtimer1>=35:
  79.             badtimer1=35
  80.         else:
  81.             badtimer1+=5
  82.     index=0
  83.     for badguy in badguys:
  84.         if badguy[0]<-64:
  85.             badguys.pop(index)
  86.         badguy[0]-=7
  87.     # 6.3.1 - Attack castle
  88.         badrect=pygame.Rect(badguyimg.get_rect())
  89.         badrect.top=badguy[1]
  90.         badrect.left=badguy[0]
  91.         if badrect.left<64:
  92.             hit.play()
  93.             healthvalue -= random.randint(5,20)
  94.             badguys.pop(index)
  95.     #6.3.2 - Check for collisions
  96.         index1=0
  97.         for bullet in arrows:
  98.             bullrect=pygame.Rect(arrow.get_rect())
  99.             bullrect.left=bullet[1]
  100.             bullrect.top=bullet[2]
  101.             if badrect.colliderect(bullrect):
  102.                 enemy.play()
  103.                 acc[0]+=1
  104.                 badguys.pop(index)
  105.                 arrows.pop(index1)
  106.             index1+=1
  107.     # 6.3.3 - Next bad guy
  108.         index+=1
  109.     for badguy in badguys:
  110.         screen.blit(badguyimg, badguy)
  111.      # 6.4 - Draw clock
  112.     font = pygame.font.Font(None, 24)
  113.     survivedtext = font.render(str((90000-pygame.time.get_ticks())/60000)+":"+str((90000-pygame.time.get_ticks())/1000%60).zfill(2), True, (0,0,0))
  114.     textRect = survivedtext.get_rect()
  115.     textRect.topright=[635,5]
  116.     screen.blit(survivedtext, textRect)
  117.     # 6.5 - Draw health bar
  118.     screen.blit(healthbar, (5,5))
  119.     for health1 in range(healthvalue):
  120.         screen.blit(health, (health1+8,8))
  121. # 7 - update the screen
  122.     pygame.display.flip()
  123. # 8 - loop through the events
  124.     for event in pygame.event.get():
  125.         # check if the event is the X button
  126.         if event.type==pygame.QUIT:
  127.             # if it is quit the game
  128.             pygame.quit()
  129.             exit(0)
  130.         if event.type == pygame.KEYDOWN:
  131.             if event.key==K_w:
  132.                 keys[0]=True
  133.             elif event.key==K_a:
  134.                 keys[1]=True
  135.             elif event.key==K_s:
  136.                 keys[2]=True
  137.             elif event.key==K_d:
  138.                 keys[3]=True
  139.         if event.type == pygame.KEYUP:
  140.             if event.key==pygame.K_w:
  141.                 keys[0]=False
  142.             elif event.key==pygame.K_a:
  143.                 keys[1]=False
  144.             elif event.key==pygame.K_s:
  145.                 keys[2]=False
  146.             elif event.key==pygame.K_d:
  147.                 keys[3]=False
  148.             if event.type==pygame.MOUSEBUTTONDOWN:
  149.                 shoot.play()
  150.                 position=pygame.mouse.get_pos()
  151.                 cc[1]+=1
  152.                 arrows.append([math.atan2(position[1]-(playerpos1[1]+32),position[0]-(playerpos1[0]+26)),playerpos1[0]+32,playerpos1[1]+32])
  153. # 9 - Move player
  154.     if keys[0]:
  155.         playerpos[1]-=5
  156.     elif keys[2]:
  157.         playerpos[1]+=5
  158.     if keys[1]:
  159.         playerpos[0]-=5
  160.     elif keys[3]:
  161.         playerpos[0]+=5
  162. #10 - Win/Lose check
  163.     if pygame.time.get_ticks()>=90000:
  164.         running=0
  165.         exitcode=1
  166.     if healthvalue<=0:
  167.         running=0
  168.         exitcode=0
  169.     if acc[1]!=0:
  170.         accuracy=acc[0]*1.0/acc[1]*100
  171.     else:
  172.         accuracy=0
  173. # 11 - Win/lose display        
  174. if exitcode==0:
  175.     pygame.font.init()
  176.     font = pygame.font.Font(None, 24)
  177.     text = font.render("Accuracy: "+str(accuracy)+"%", True, (255,0,0))
  178.     textRect = text.get_rect()
  179.     textRect.centerx = screen.get_rect().centerx
  180.     textRect.centery = screen.get_rect().centery+24
  181.     screen.blit(gameover, (0,0))
  182.     screen.blit(text, textRect)
  183. else:
  184.     pygame.font.init()
  185.     font = pygame.font.Font(None, 24)
  186.     text = font.render("Accuracy: "+str(accuracy)+"%", True, (0,255,0))
  187.     textRect = text.get_rect()
  188.     textRect.centerx = screen.get_rect().centerx
  189.     textRect.centery = screen.get_rect().centery+24
  190.     screen.blit(youwin, (0,0))
  191.     screen.blit(text, textRect)
  192. while 1:
  193.     for event in pygame.event.get():
  194.         if event.type == pygame.QUIT:
  195.             pygame.quit()
  196.             exit(0)
  197.     pygame.display.flip()
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-5-25 17:49:51 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-6-3 10:50

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表