""" 第一人称射击.py """ from sprites import * try: import pygame pygame.mixer.init() fire_sound = pygame.mixer.Sound("audio/发射声.wav") cricket_sound = pygame.mixer.Sound('audio/cricket.wav') except: import sys input("本程序需要pygame混音器支持以便配音,请先在cmd下用pip install pygame安装此模块。") width,height = 480,360 screen = Screen() screen.bgpic('res/ghosthouse.jpg') screen.setup(width,height) batimages = ['res/bat1.png','res/bat2.png'] batindex = 0 bat = Sprite(visible=False,pos=(-50-width//2,100)) bat.dx = 3 bat.dy = 0 bat.alive = True bat.show() def bat_alt_costume(): global batindex batindex = 1 - batindex bat.shape(batimages[batindex]) screen.ontimer(bat_alt_costume,90) bat_alt_costume() hole = Sprite(shape='res/Bullet_Hole.png',visible=False) m1 = Mouse(1) # 鼠标左键 m3 = Mouse(3) # 鼠标右键 clock = Clock() # 时钟对象 start_stamp = False 以下代码省略......
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)