我是初学者
import pygame as py
from math import sqrt, pow
nuclear = py.transform.scale(py.image.load('nuclear.png'),(300, 300))
def collosion(enemyX,enemyY,fireX,fireY):
distance = sqrt(pow(enemyX - fireX, 2) + pow(fireY - enemyY, 2))
if distance <= 100:
return True
else:
return False
collosion1 = collosion(enemy1_x,enemy2_y,shoot1X + 50, shoot1Y + 60)
if collosion1:
window.blit(nuclear,(enemy1_x,enemy2_y))
enemy1_x = 1400
enemy2_y = 530
shoot1X = tankX
shoot1Y = tankY
shoot_now = 'not fired'
shoot1 = py.transform.scale(py.image.load('shoot1.png'), (70, 30))
我如何使“核”图像停留一段时间(至少2秒)。
谢谢你的帮助
这就是显示文本的方式。这不完全是您想要的,但可能会有所帮助:
BASICFONT = pygame.font.Font('freesansbold.ttf', 16)
WHITE = (255, 255, 255)
instructionSurf = BASICFONT.render('Arrows to move. Hold shift to run.', True, WHITE)
instructionRect = instructionSurf.get_rect()
instructionRect.bottomleft = (10, WINDOWHEIGHT - 10)
display.blit(instrutcionSurf, instructionRect)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)