以下是部分代码预览:
"""本程序定义可旋转360度的角色类,它继承自海龟类,使用pillow模块让它旋转360次"""
import os
import sys
import math
import time
import tempfile
from PIL import Image
from turtle import Turtle,Screen
def get_mouse_xy():
"""获取鼠标指针的坐标"""
mousex = Sprite.mousex
def shoot(x,y):
speed = 10
position = (x,y)
image = "bullet.png"
def check_collide(word_group,bullet_group):
"""碰撞检测"""
global score
removed_word = set()
removed_bullet = set()
wg = word_group.copy() # 由于在迭代的过程中可能会改变集合所以用副本
bg = bullet_group.copy()
if __name__ == "__main__":
score = 0 # 得分
explosion_images = glob("explosion/*.gif")
sprite_image = "大炮.png" # 大炮图
word_group = set()
bullet_group = set()
screen = Screen()
screen.delay(0)
screen.setup(800,600)
screen.colormode(255)
screen.bgcolor((4,21,104))
screen.listen()
screen.mainloop()
本程序较长,下载完整源代码与素材,包括所有子模块,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)

