python - 当我重生敌人 ursina 时,实体碰撞不起作用
问题描述
我的碰撞正常,但是当我制造另一个敌人时,它的碰撞不起作用,有人知道为什么吗?
编码:
#Objects
Player = Entity(model='quad', color=color.black, hp=10, collider = 'box')
Enemy = Entity(parent = scene, text='Enemy', model = 'quad', color = color.gray, scale = 1, hp = 10, collider = 'box')
Enemys = [Enemy]
#Events
def update():
global Player
global Enemys
if Enemys[0].intersects().hit:
if Enemys[0].intersects().entity.color == color.yellow:
destroy(Enemys[0])
Enemys.clear()
Enemy = Entity(parent=scene, text='Enemy', model='quad', color=color.gray, scale=1, hp=10, collider='box', position=(random.uniform(1, 3), random.uniform(1, 3), random.uniform(1, 5)))
Enemys.append(Enemy)
解决方案
推荐阅读
- javascript - 使用 setInterval 时变量不会在全局范围内更新
- directshow - 带有转换过滤器的 DirectShow Graph,同时提供预览和捕获
- reactjs - 将数据从类传递到类外的常量函数集
- javascript - 用动画中的幻灯片替换行点击时卡片的内容
- .htaccess - OpenCart 2.2:https 配置未加载 css
- django - GDAL 库显示 OSError 的 Geodjango 错误:[WinError 126] 找不到指定的模块
- java - PSQLException:预期没有结果时返回了结果
- ruby-on-rails - Capybara 按钮 JS 响应 ActionController 错误
- python - 在python中对html选项列表进行排序
- android - 程序类型已经存在:使用带有 firebase 和 google play 服务的 androidx 库无法构建 android studio 3.1.1