The way I want to do that is draw a ray from Player() to the cat which is meow.Meow, and then update the text on screen every time the player collides with the cat.
class Player(Entity):
def __init__(self):
super().__init__(collider="box")
self.position = (0, 5, 0)
self.collider = 'box'
self.height = 2
self.speed = 5
self.gravity = 10
self.y_velocity = 0
self.jump_velocity = 5
self.on_ground = True
self.sprint_speed_modifier = 2
self.interact_distance = 5
self.shooting = False
self.last_shot = time.time()
self.mouse_sensitivity = Vec2(40, 40)
self.crosshair = Entity(parent=camera.ui, model='quad', color=color.white, scale=0.008, rotation_z=45)
self.camera_parent = Entity(parent=self, y=self.height)
self.inventory = Inventory(
Weapon(self.camera_parent, 0.25, (0.25, -0.25, 0.30), 180, 5, 20, True, 40, 0.25, 5, model='tommygun',
texture='tommygun'))
# self.weapon = Entity(parent=self.camera_parent, model='tommygun', texture='tommygun', position=(0.75, -0.95, 1), rotation_y=180)
self.health = 1000
camera.parent = self.camera_parent
camera.position = (0, 0, 0)
camera.rotation = (0, 0, 0)
camera.fov = 90
mouse.locked = True
global player_instance
player_instance = self
def tealth():
self.health -= 10
if isinstance(Player, meow.Meow):
tealth()
above is the local player class that I am doing that in.