Python全系列 教程
3567个小节阅读:5931.4k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
xxxxxxxxxx
261 #子弹的移动方法
2 def bulletMove(self):
3 if self.direction == 'U':
4 if self.rect.top > 0:
5 self.rect.top -= self.speed
6 else:
7 #修改状态值
8 self.live = False
9 elif self.direction == 'D':
10 if self.rect.top < MainGame.SCREEN_HEIGHT - self.rect.height:
11 self.rect.top += self.speed
12 else:
13 # 修改状态值
14 self.live = False
15 elif self.direction == 'L':
16 if self.rect.left > 0:
17 self.rect.left -= self.speed
18 else:
19 # 修改状态值
20 self.live = False
21 elif self.direction == 'R':
22 if self.rect.left < MainGame.SCREEN_WIDTH - self.rect.width:
23 self.rect.left += self.speed
24 else:
25 # 修改状态值
26 self.live = False
运行效果