```"""

any函数：可迭代序列中有一个数据用bool运算的结果为真，即为真。
all函数：可迭代序列中有一个数据用bool运算的结果为假，则为假，全部为真，则为真，要不怎么叫all呢。
>>> help(any)
Help on built-in function any in module builtins: 内置模块中的内置函数

any(iterable, /)
Return True if bool(x) is True for any x in the iterable.可迭代序列中有一个bool运算为真则返回真

If the iterable is empty, return False.如果可迭代序列是空的，返回假

>>> help(all)
Help on built-in function all in module builtins:

all(iterable, /)                            可迭代序列中所有bool运算为真才返回真
Return True if bool(x) is True for all values x in the iterable.

If the iterable is empty, return True.如果可迭代序列是空的，返回真

>>>

"""

import os

# 常量定义
SPRITE_SCALING_PLAYER = 0.5

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

""" Our custom Window Class"""

def __init__(self):
""" Initializer """
# 调用父类的初始化方法新建一个窗口
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)

# 角色列表定义
self.player_list = None
self.coin_list = None

# 玩家角色定义
self.player_sprite = None

# 道具角色定义(触发器)
self.trigger_sprite = None

# 不显示鼠标指针
self.set_mouse_visible(False)

def setup(self):
""" 设置游戏，初始化变量"""

# 实例化角色列表

# 实例化角色
self.player_sprite.center_x = 50         # 角色x坐标
self.player_sprite.center_y = 150        # 角色的y坐标
self.player_list.append(self.player_sprite)

# 实例化一些金币
for x in range(100, 800, 100):
coin = arcade.Sprite("images/coin_01.png", scale=0.3, center_x=x, center_y=400)
coin.intensity = 'dim'           # 这是增加的一个属性
coin.alpha = 64                  # 透明度
self.coin_list.append(coin)

# 创建一个触发器
self.trigger_sprite = arcade.Sprite("images/bumper.png", scale=0.5, center_x=750, center_y=50)

def on_draw(self):
""" Draw everything """
self.coin_list.draw()
self.trigger_sprite.draw()
self.player_list.draw()

# Put the instructions on the screen.
instructions1 = "去碰金币，点亮它吧."
instructions2 = "去碰右下角的道具把亮着的金币销毁吧."

# Query the property on the coins and show results.
coins_are_bright = [coin.intensity == 'bright' for coin in self.coin_list]
output_any = f"有金币被点亮了吗? : {any(coins_are_bright)}"
output_all = f"所有金币都被点亮了? : {all(coins_are_bright)}"

def on_mouse_motion(self, x, y, dx, dy):
""" 处理鼠标移动 """

# 把玩家的坐标放到鼠标指针的坐标
self.player_sprite.center_x = x
self.player_sprite.center_y = y

def update(self, delta_time):
""" 移动和游戏逻辑 """

# 更新所有的金币
self.coin_list.update()

# 玩家在on_mouse_motion方法中，坐标已经实时更新

# 创建所碰到的金币列表

# 遍历所碰到的金币，把它们点亮
for coin in coins_hit_list:
coin.intensity = 'bright'
coin.alpha = 255

if hit_trigger:
# 返回亮了的金币列表
intense_sprites = [sprite for sprite in self.coin_list if sprite.intensity == 'bright']
for coin in intense_sprites:
coin.kill()

def main():
""" Main method """
window = MyGame()
window.setup()