首页 > 解决方案 > 当我重生敌人 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)

标签: python

解决方案


推荐阅读